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'
In reply to Re^3: Generalising string in pattern
by shmem
in thread Generalising string in pattern
by rajyalakshmi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |