RE: regex
Claude Brown via beginners <[email protected]> Mon, 22 Jan 2024 21:49:50 +0000
| Newsgroups | gmane.comp.lang.perl.beginners |
|---|---|
| Message-ID | <SYBP282MB2527DAC95733AB2015E482C5C7752@SYBP282MB2527.AUSP282.PROD.OUTLOOK.COM> |
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/