Re: multiple overlapping matches in a regex

2005-10-03 Thread Jeff 'japhy' Pinyan
On Oct 3, Frank Geueke, III said: while() { my @matches = m/([A-Z])[A-Z]{2,}/; print "@matches\n"; } The input file contains: HELLo WoRLD You have two problems. First, you're not telling the regex to find all instances it can with the /g (for *g*lobal matching) flag. Second, a rege

multiple overlapping matches in a regex

2005-10-03 Thread Frank Geueke, III
There's probably a really simple answer to this one. I'm trying to find multiple matches to a regex within a file, replace them, and save in another file... #!/usr/bin/perl -w use warnings; use strict; open(INFILE, "<1.ls") or die("Couldn't open input file.\n"); open(OUTFILE, ">3.ls") or die("Cou