in reply to Re^2: Generalising string in pattern
in thread Generalising string in pattern
Two ways:
then match $pattern against $strmy $string='i am using perl'; (my $str = $string) =~ s/\s+//g;
then match $pattern against $stringmy $pattern = 'iamusingper'; $pattern =~ s/(.)/.\\s*$1/g;
Update: contrary to the title, you apparently don't want to ignore spaces in the regular expression (that's what the /x modifier is for), but in the string you are matching against.
2009-11-14
Original title: 'ignoring spaces in the (was: Regular expressions) string'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Generalising string in pattern
by keszler (Priest) on Nov 13, 2009 at 15:27 UTC | |
by shmem (Chancellor) on Nov 13, 2009 at 15:31 UTC |