[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Is this fun? What's going on?



"Bill Jones" <bill@fccj.org> writes:

> What can I change to also match an optional
> third or fourth  (  #.#.#  or #.#.#.# ) section number???
> 
> I am looking at various forms of -
> s{(\d+\.\d+){1}(\.\d+)?(\.\d+)?}  {<A HREF="$1">$1</A>}g;
> 
> But that actually truncates the results...

s{(\d+\.\d+)((?:\.\d+)*)}{<A HREF="$1$2">$1$2</A>}g;

This should do what you want.  Semi-fun use of (?:...) :)

Chip

-- 
Chip Turner                   chip@ZFx.com
                              Programmer, ZFx, Inc.  www.zfx.com
                              PGP key available at wwwkeys.us.pgp.net

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe