On Jul 15, Kevin Pfeiffer said: >Jeff 'japhy' Pinyan writes: >[...] >> Here's a working regex: >> >> s/(\d)(?=\d)/$1./g; > >[converts 1234 to 1.2.3.4] > >> The (?=\d) looks ahead for a digit, without actually consuming it. > >What does that mean? Does it say, "match a digit, but always check to see >that there is still at least one remaining ahead"? Thus avoiding "1.2.3.4." >(dot at end)?
That's pretty accurate. You see, as the regex matches, it advances in the string. This is called "consuming" characters. When you use a look-ahead or look-behind, the regex un-consumes the characters after it's matched them. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]