David -- ...and then David Newman said... % % many thanks...
Here's hoping I can help, too :-) % % > Set $/ to undef instead. Good. % > ... % > > if (m/(p1)*.(p2)/ms) { ... % > When $/ is "", it's like the regex /\n{2,}/. % % ....wouldn't this have worked before, since the pattern was p1\n\np2? (2 % newlines) Yes, but your *. should be .* to work. When you have (p1)*. you're asking for zero or more p1 followed by any single character, but when you have (p1).* you're asking for p1 followed by zero or more characters. Subtle :-) % % > If it's undef, then <FILE> % > slurps the entire file at once. % > % % OK, but with $/ undef'd the code now finds just a single instance of the % match. % % If I do (for example) "p1 p2 p1 p2\n\np1 p2", shouldn't the while loop match % on 3 instances? If not, what should I use to match each instance? Now that it's all one big line, you need /g to make it global (more than just the first on the line). Time to go back to the Camel book for some reading; while regexps can be tricky, you *can* get to the bottom of them! % % Again, my goal is to match each instance of /(p1)*anything*(p2)/. I should think that undef $/ ; ... /(p1).*(p2)/g ; would do it for you. % % thanks again! % % dn HTH & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
msg28031/pgp00000.pgp
Description: PGP signature