in reply to Re: Cleaner regex conversion
in thread Cleaner regex conversion

This is perfect. I haven't seen the format before this:

s/()/"." x ()/ge

Is there a URL or book that covers these more advanced regexp?

Replies are listed 'Best First'.
Re^3: Cleaner regex conversion
by jethro (Monsignor) on Jul 05, 2008 at 13:59 UTC
    Well, the official perl book is 'Programming Perl' (Wall,Christiansen,Schwartz) and it naturally has this and practically everything else covered.

    Also check out the manual pages, in this case perlre (also available online: http://perldoc.perl.org/perlre.html ).

      Hmm. I have a copy of that book but it is several years old. I also checked the perlre and didn't find reference to the use of 'x' in the replace portion of the expression:

      s/()/"." x ()/ge

      Can you give me a more specific reference? I've looked but do not see it.

        Check out perldoc perlop - Multiplicative Operators

        update: sorry; nevermind, I missed your next entry...

      Thanks. Nevermind the last comment. I found it under Multiplicative Operators in the web link you provided.
        Ah, I see. You thought the x operator was a special regex. But really the interesting thing is the e at the end of the regex, with that you can put anything inside the regex, the substitution pattern is like a block or subroutine.