perl regular expressions

Marty Pauley marty+belfast-pm at
Thu Jul 11 06:11:03 CDT 2002

On Wed Jul 10 13:09:41 2002, Dave Wilson wrote:
> I have this little beauty:
>    /%([#0\-+'I]?)([\-0-9]*)(\.[0-9\*m\$]*)?([hlLqjzt])
>    ?([diouxXeEfFgGaAcsCSpn])/";

Looks like perl to me, although I can shave off 5 strokes :-)
>    /%([#0\-+'I]?)([\-0-9]*)(\.[0-9\*m\$]*)?([hlLqjzt])?([diouxXeEfFgGaAcsCSpn])/

> My problem with doing this using a PCRE is finding out the exact position
> in the format string where the 'S' of "%...S" occured. Is there a fancy way
> in perl regexs to get the regex parser to drop its current offset into a
> register?

In Perl the start and end points of all the sub-matches are stored
automatically, so PCRE probably stores them too.  In Perl you would look
at $+[5]-1.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
Url :

More information about the Belfast-pm mailing list