in reply to Re: Re: Re: How do I match lines of UP TO 40 chars BUT NO MORE in a block of text?
in thread How do I match lines of UP TO 40 chars BUT NO MORE in a block of text?

WOW SAROQ! I think that finally did it! Thanks for all your help in this. As far as requests go, it is tough explaining things, and I know you gurus are excellent at responding quickly, that I get impatient. Sorry, learnt my lesson here.

Anyway, my boss is going to test it, and lets hope it goes well for her.

One quick question, I dont understand what the ?: at the beginning of the regex does. I took the comments out. What's the diff between these:

1. ($foo =~ /^(?:.{0,40}\n){0,4}$/ 2. ($foo =~ /^(.{0,40}\n){0,4}$/ # note no ?:

CHEERS MATE!
Robert

  • Comment on Re: Re: Re: Re: How do I match lines of UP TO 40 chars BUT NO MORE in a block of text?
  • Download Code

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: How do I match lines of UP TO 40 chars BUT NO MORE in a block of text?
by sauoq (Abbot) on Sep 26, 2002 at 02:11 UTC

    Without the ?: the parens will capture the match into $1. You probably don't need to capture. Presumably, not capturing will give you slightly better performance, though it probably wouldn't be noticeable unless you were doing a whole lot of matching.

    Glad I could help.

    -sauoq
    "My two cents aren't worth a dime.";
    
      Well, the boss liked it! Thanks again Sauoq!

      Robert