in reply to Re: Long regexp un multiple lines
in thread Long regexp un multiple lines

Enlil (et. al.), one of the convenient things about qr// is that it returns a self-contained regex. That means your "later on" code can be /^$x{5}$x$/ It seems weird to me that there's no simpler way to say "pattern X, N times, with pattern Y in between"... you have to write /^(?:XY){N-1}X$/. I wonder if there's something in Regexp::Common for that.
_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: Re: Long regexp un multiple lines
by davido (Cardinal) on Apr 22, 2004 at 20:05 UTC
    Actually the reason he had to use the (?:$x:){5} approach is because of the colon character that's supposed to delimit each grouping. Your solution leaves that out entirely. Yours will expand to:
    /^(?:[\da-f]{2}){5}(?:[\da-f]{2})$/
    ...note the missing : colons.


    Dave

      Oh, oops, duh.
      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;