in reply to Regex Question
The first thing I noticed was that you are undefing $/. Apart from that just localising it it enough to set to undef, that is usually done when you are slurping the entire file.
The second thing I noticed was that you are using /smx.
If I am interpretung your snippet correctly, you are slurping the whole file, asking that . match \n (/s), asking that ^ and $ match either side of \n (/m), and then hoping that
/(^DES|^TN).*?/ will match just a single line, with the correct first 2 or 3 letters. It won't.
It will match starting at the first newline followed by DES or TN, but with go on to match the rest of the entire file as there is nothing to stop .*? matching.
By the time you get to your end criteria, the is nothing left for it to match against.
A lot of assumptions based on little evidence, but it does fit what I see:)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex Question
by set_uk (Pilgrim) on Jun 03, 2003 at 10:45 UTC | |
by BrowserUk (Patriarch) on Jun 03, 2003 at 11:11 UTC | |
by set_uk (Pilgrim) on Jun 03, 2003 at 11:51 UTC | |
by BrowserUk (Patriarch) on Jun 03, 2003 at 12:53 UTC |