Show us what is contained in $pattern. If it is just "xy", what you have posted wont find it anyway if xy is embedded between non-space characters. Your existing regex doesnt seem to reflect the behavior you're describing.
Dave
In reply to Re: while =~ consecutive matching problem
by davido
in thread while =~ consecutive matching problem
by p.s
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |