Do you know where your variables are? | |
PerlMonks |
Re^3: Regular Expression Hiccupby AnomalousMonk (Archbishop) |
on May 04, 2015 at 21:46 UTC ( [id://1125640]=note: print w/replies, xml ) | Need Help?? |
... "X-ray" simply fails. What others have written remains true: a '-' (dash; hyphen) character is not the same as (and will not match) a ' ' (space) character. (Also pay attention to hdb's reply below (update: among others) concerning case-insensitive matching.) Consider these matches to get a feel for regex matching:
Contrast the use of [- ]? with . (dot) as a placeholder to match anything at all: In general, it's better to match exactly what you want. Please see the Perl regex documentation perlre, perlretut, perlrequick, and various regex tutorials on Perlmonks. Give a man a fish: <%-(-(-(-<
In Section
Seekers of Perl Wisdom
|
|