Re: [OT] - Regex help

2007-10-18 Thread Florian Kulzer
On Thu, Oct 18, 2007 at 15:05:18 +0200, Andrea Ganduglia wrote: > $str = 'I\'m a text: =match1 =match2=match3=match4 =nomatch{} > =match5=match6'; > //$rex = "/=[A-z]+/"; // works but not exclude =nomatch{} > $rex = "/=[A-z0-9]+(\s|=)/"; // > $N = preg_match_all($rex,$str,$out); >

Re: [OT] - Regex help

2007-10-18 Thread Mumia W..
On 10/18/2007 08:05 AM, Andrea Ganduglia wrote: Use grep to remove the unwanted match like so (watch out for wrapping): $str = 'I\'m a text: =match1 =match2=match3=match4 =nomatch{} =match5=match6'; $rex = "/=[A-z0-9]+/"; $N = preg_match_all($rex,$str,$out); $out[0] = preg_gr

[OT] - Regex help

2007-10-18 Thread Andrea Ganduglia
Sorry for OT. I have a little problem with regex above. The script is in PHP, but regex should be compatible with Perl. I want match =[A-z0-9] where char after this is \s or =, final = is the start char of next match. How can go back after first matching? The result of the script Array ( [0

Re: regex help

2007-08-21 Thread Mumia W..
On 08/21/2007 04:29 PM, Mumia W. wrote: Sort::Maker should make short work for this task ;-) [...] Sorry, I sent this to the wrong list :-( -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Re: regex help

2007-08-21 Thread Mumia W.
On 08/21/2007 07:41 AM, Tony Heal wrote: the list is a list of files by version. I need to keep the last 5 versions. Jeff's code works fine except I am getting some empty strings at the beginning that I have not figured out. Here is what I have so far. Lines 34 and 39 are provide a print out f

Re: Regex help

2004-12-10 Thread Francois Cerbelle
Le Fri, Dec 10, 2004 at 07:15:50AM -0800, Alex Barylo ecrit : > #!/usr/bin/perl > for (<>) { > s!\{_(Start|End)Range_\}!!; > while (s!\{_Index\s+([^}]+)\s+_\}!!) { print "%s/$1//g\n" } > } ---end quoted text / fin de citation--- I already had something similar on another list. But thanks you for h

Re: Regex help

2004-12-10 Thread Francois Cerbelle
Le Fri, Dec 10, 2004 at 04:47:56PM +0100, Maurits van Rees ecrit : > > I've never been called a regex expert, but I hope this code does the > trick. ---end quoted text / fin de citation--- Thanks a lot, I had another answer with a perl program which fits my needs. Anyway, I'll keep your code, it

Re: Regex help

2004-12-10 Thread Maurits van Rees
On Fri, Dec 10, 2004 at 01:58:04PM +0100, Francois Cerbelle wrote: > My source file looks like : > > Text {_Index blabla:we _} bla {_Index {_StartRange_} bla _} bla > vla > stuff > bbgfd {_Index {_EndRange_} bla _} > -

Re: Regex help

2004-12-10 Thread Alex Barylo
Try this: #!/usr/bin/perl for (<>) { s!\{_(Start|End)Range_\}!!; while (s!\{_Index\s+([^}]+)\s+_\}!!) { print "%s/$1//g\n" } } HTH, Alex. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Regex help

2004-12-10 Thread Francois Cerbelle
--- Begin Message --- Hi debian-users, I am translating an O'Reilly book to French and the source code is in FrameMaker format. The textual part is already translated but I still have to translate the index entries. I have to be consistent and to always use the same words across the document. As t