Re: regex
[email protected] (Andy Bach) Mon, 22 Jan 2024 18:40:02 -0600
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <CACV6rWJvSZwjLzLBTKO=nBWqGiSPb=8GdQZiO_03Q9n-Vufnrw@mail.gmail.com> |
There are a number of websites that have RE validators that let you see, step by step, what the RE is matching and why. Actually, there's a Perl module that does that, in text mode, written by Damian Conway. And a really great book is O'Reilly's Mastering Regular Expressions, by J. Friedl https://www.oreilly.com/library/view/mastering-regular-expressions/0596528124/ probably a bootleg copy on-line somewhere. On Mon, Jan 22, 2024 at 6:34 PM armando perez pena <[email protected]> wrote: > Hi, > > Sometimes the large path is the shortest one. Go through the tutorial in > Perl for regular expressions and you will solve your questions and you will > learn a lot. > > About regular expressions are two points of view. First one says that you > must learn and use it. > > The other point of is: if you have a problem and you say I will solve it > with regular expressions then you have two problems. > > Ánimos! > Saludos > ------------------------------ > *From:* Claude Brown via beginners <[email protected]> > *Sent:* Monday, January 22, 2024 10:49:50 PM > *To:* [email protected] <[email protected]>; [email protected] < > [email protected]> > *Subject:* RE: regex > > Jorge, > > Expanding on Karl's answer (and somewhat labouring his point) consider > these examples: > > $a =~ /Jorge/ > $a =~ /^Jorge/ > $a =~ /Jorge$/ > $a =~ /^Jorge$/ > > This shows that regex providing four different capabilities: > - detect "Jorge" anywhere in the string > - detect "Jorge" at the start of a string (by adding ^) > - detect "Jorge" at the end of a string (by adding $) > - detect that the string is exactly "Jorge" (both ^ and $) > > Replace "Jorge" with your pattern, and the result is the same. > > Cheers, > > Claude. > > > > > > -- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > http://learn.perl.org/ > > > -- a Andy Bach, [email protected] 608 658-1890 cell 608 261-5738 wk