Now that you mention it, I don't recall any "tutorial" sites off the top of
my head that go beyond the basics of RegEx (they all seem to assume that
once you have the basics down you can string together what you know to
generate advanced ones).  If I get some time I may need to do something
about that...

I used the O'rielly books - Programming Perl, Perl Cookbook and Advanced
Perl Programming along with years of trial and error. I still have to
sometimes play with a RegEx to get it right if it's advanced and I usually
just google when I need a quick reminder of something.

James

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Adam Melancon
Sent: Tuesday, August 03, 2004 10:06 AM
To: [email protected]
Subject: Re: [brlug-general] noob regex question

What is the best place to learn about Regex.
Is there a good site that takes you from the beginning all the way to
advanced expressions?

On Tue, 3 Aug 2004 11:01:46 -0500, James Kuhns <[EMAIL PROTECTED]> wrote:
> Oops - explination wrong...
> 
> Without the g it would return a scalar 1 if a match was found or false 
> if not, you would need to backreference $1 to get the found value.
> 
> 
> James
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf Of James Kuhns
> Sent: Tuesday, August 03, 2004 9:53 AM
> To: [email protected]
> Subject: RE: [brlug-general] noob regex question
> 
> Regex alone: /\{([^\}]*)\}/g
> notice the g at the end - without it the regex would return a scalar 
> with
> text1 in it
> Regex basically says: find a string that starts with { and ends with } 
> but does not have any }'s in the middle (avoids greedy matches - if 
> you use .* instead of [^\}]* you would get everything from the first { 
> to the last })
> 
> Regex in action:
> 
> #!/usr/bin/perl
> 
> my $str = 'this is some {text1}. this is more {text2}. and yet some 
> more {text3}.';
> 
> my @results = $str =~ /\{([^\}]*)\}/g;
> 
> # displays text3 (last match found)
> print "$1\n";
> 
> # displays text1, text2 and text3
> foreach $result (@results)
> {
>         print $result."\n";
> }
> 
> James
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf Of John Hebert
> Sent: Tuesday, August 03, 2004 9:20 AM
> To: [email protected]
> Subject: [brlug-general] noob regex question
> 
> Howdy,
> 
> I have a bunch of text with multiple tokens in it demarcated by { and }.
> 
> Sample text:
> this is some {text1}. this is more {text2}. and yet some more {text3}.
> blahdeblah.
> 
> What would a regular expression to get these tokens out of the text 
> look like, in a Perl script, say?
> 
> Thanks,
> John
> 
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://brlug.net/mailman/listinfo/general_brlug.net
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://brlug.net/mailman/listinfo/general_brlug.net
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://brlug.net/mailman/listinfo/general_brlug.net
> 


--
Adam Melancon
Work: http://www.vermilion.lib.la.us
Personal: http://www.melancon.org

_______________________________________________
General mailing list
[email protected]
http://brlug.net/mailman/listinfo/general_brlug.net

Reply via email to