in reply to Re: Matching pattern in regular expression with string position
in thread Matching pattern in regular expression with string position
In order for pos() to work, he'll need to add a /g modifer. It only works on "global" matches.
Also, it's not the scalars $+ and $- which would be of interest but the arrays @+ and @- which would be. Finally, $+[0] and $-[0] are both useful even without any capturing because they hold offsets from the entire match.
In his case, $-[0] is exactly what he needs.
-sauoq "My two cents aren't worth a dime.";
|
|---|