perl regular expressions
Marty Pauley
marty+belfast-pm at kasei.com
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])/
/%([-#0+'I])?([-0-9]*)(\.[0-9*m\$]*)?([hlLqjzt])?([ac-ginopsuxACEFGSX])/
> 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.
--
Marty
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
Url : http://mail.pm.org/archives/belfast-pm/attachments/20020711/cb7619ad/attachment.bin
More information about the Belfast-pm
mailing list