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

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



Given:

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

Why does the first match '$1" get the whole match, and
'$2' is getting the partial (which I feel is arriving
from the first (\d+\.)  ?

However, this new match isn't really picking up the
complete first match.  IE -

I have 1.2 and it matches 1.2 and 1. respectively;
but when I have 1.2.3 - the .3 is lost...

Where 1.2.3.? = book.chapter.section.keyword.et al...

What I wanted was -

$1 = complete match, $2 = book and chapters, etc.
(or, maybe have $3 = chapters, and $4 = sections?)

I even tried:

(?=\d+(?:\.\d+)+)  but then nothing shows up in $2...

???
-Sneex-  :]

PS - The original code was:  s{(\d+(?:\.\d+)+)} {"$1"}g;

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