in reply to Pattern Matching with REGEXP: Is the match position trackable?
However, since you wanted the position of the _first_ 5, I'd substitute @- (also known as @LAST_MATCH_START) for pos.
# following line stolen shamelessly from belg4mit's post while( /(?<=H)5+(?=H)/g ){ print $-[0]; }
Oh yeah, FYI @LAST_MATCH_START starts counting at zero, not one.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Pattern Matching with REGEXP: Is the match position trackable?
by belg4mit (Prior) on Sep 18, 2002 at 13:48 UTC | |
by luthor (Initiate) on Sep 18, 2002 at 16:17 UTC |