$words_to_match = qr/\s*Hello\s+World\s*/; # use \s* or \s+ as needed @trials = ("Hello World", " Hello World ", "Hello,World"); for ( @trials ) { $result = ( /$words_to_match/ ) ? "matches" : "does not match"; print "$_ $result\n"; }
In reply to Re: disregard spaces while matching ?
by graff
in thread disregard spaces while matching ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |