Interesting little regex

Charles Curley charlescurley at charlescurley.com
Thu Feb 23 11:05:07 MST 2006


On Thu, Feb 23, 2006 at 10:01:00AM -0700, Jason Hall wrote:
> Alan Young wrote:
> >In trying to get something done a co-worker came up with this little regex:
> >
> >perl -e 
> >'$a="abcde"x200;$a=~s{((\w+?)(??{!$b{$^N}++?"(?=)":"(?!)"}))}{($1)}xg;print
> >"$a\n";'
> >
> 
> You've got the x flag, please use it!

You mean this regex is x rated?

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20060223/c679b428/attachment.bin 


More information about the PLUG mailing list