in reply to Pattern Matching with REGEXP: Is the match position trackable?
If you want to know where the match began you can use pos($seq) - length($&) inside your while loop.
I also suggest using /H+5+H+/ instead of what you have. The + quantifier means "1 or more" but is easier to read (and type) than {1,} is.
Update: The anonymous reply below does well to point out the performance hit taken by using the $& special variable. A better approach would be to capture the whole regex with parens and then use pos($seq) - length($1) to obtain the position where the match began.
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Pattern Matching with REGEXP: Is the match position trackable?
by Anonymous Monk on Sep 18, 2002 at 01:47 UTC |