in reply to (Regex Quiz) Multi-line Matching
My first reaction was "why use the anchors?" as you're specifying the text on both sides of the newline, so the anchors are redundant: if ($string =~ /foo\nbar/m) seems to work fine. As to why the anchors don't work, and apart from them being interpreted as parts of variables (no $bar in your first example) I think it is because you are not allowing for the actual newline character. The anchors are not characters, just locations. Now for a question of my own: Why does if ($string =~ /foo.bar/m) or similar not work? |
(BTW, I'm planning to re-do my living room with the colour selection that results from this thread, so select carefully please!)
Update: Thanks nysus, I'm glad I said I hadn't done any research as that's practically the first line in the quick reference section on regex (blush). You can tell I never need to match a newline!
--
I'd like to be able to assign to an luser
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: (Regex Quiz) Multi-line Matching
by nysus (Parson) on May 22, 2001 at 23:54 UTC | |
|
Re: Re: (Regex Quiz) Multi-line Matching
by japhy (Canon) on May 23, 2001 at 00:54 UTC |