Re: regex

armando perez pena <[email protected]> Mon, 22 Jan 2024 22:07:08 +0000
Newsgroups gmane.comp.lang.perl.beginners
Message-ID <PAWP195MB24183BFB9AFB25C8F92EF420DD752@PAWP195MB2418.EURP195.PROD.OUTLOOK.COM>
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/