in reply to search hang trouble

what does the /c do in /gcsm?

Replies are listed 'Best First'.
Re^2: search hang trouble
by greatdane (Beadle) on Sep 01, 2006 at 21:34 UTC
    search options:
    c Do not reset search pos on a failed match when /g is in effect. g Match globally, i.e., find all occurrences. i Do case-insensitive pattern matching. m Treat string as multiple lines. o Compile pattern only once. s Treat string as single line. x Use extended regular expressions.
Re^2: search hang trouble
by mreece (Friar) on Sep 01, 2006 at 21:34 UTC
    ah, i found it buried in perldoc perlretut:
    If you don't want the position reset after failure to match, add the "//c", as in "/regexp/gc".
    odd that it does not appear to be mentioned in perldoc perlre..
      Because it's not a regex flag, per se. It's a pattern matching operator flag. perlre only covers /i, /m, /s, and /x.

      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
        "man perlop" has the search options covered.

        I am starting to think that it may not be hung but searching for a long long time (many 10s of minutes). A product of the cascaded non-greedy searches failing at the last pattern. I will run it and see if it ever finishes. The file I am parsing is pretty small (few thousand lines) so it should finish if it can finish.