Pragmatic approach: you could use re qw/debug/ and count the lines (or do more intelligent grepping)

see re

EDIT: But be warned that executing unfiltered regexes from user input is as dangerous as executing plain Perl code.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

UPDATE

DB<3> use re "debug"; print 'abcdc' =~ /(.).*\1/ Compiling REx "(.).*\1" Final program: 1: OPEN1 (3) 3: REG_ANY (4) 4: CLOSE1 (6) 6: STAR (8) 7: REG_ANY (0) 8: REF1 (10) 10: END (0) minlen 1 Matching REx "(.).*\1" against "abcdc" 0 <> <abcdc> | 0| 1:OPEN1(3) 0 <> <abcdc> | 0| 3:REG_ANY(4) 1 <a> <bcdc> | 0| 4:CLOSE1(6) 1 <a> <bcdc> | 0| 6:STAR(8) | 0| REG_ANY can match 4 times out of 2 +147483647... 5 <abcdc> <> | 1| 8:REF1: "a"(10) | 1| failed... 4 <abcd> <c> | 1| 8:REF1: "a"(10) | 1| failed... 3 <abc> <dc> | 1| 8:REF1: "a"(10) | 1| failed... 2 <ab> <cdc> | 1| 8:REF1: "a"(10) | 1| failed... 1 <a> <bcdc> | 1| 8:REF1: "a"(10) | 1| failed... | 0| failed... 1 <a> <bcdc> | 0| 1:OPEN1(3) 1 <a> <bcdc> | 0| 3:REG_ANY(4) 2 <ab> <cdc> | 0| 4:CLOSE1(6) 2 <ab> <cdc> | 0| 6:STAR(8) | 0| REG_ANY can match 3 times out of 2 +147483647... 5 <abcdc> <> | 1| 8:REF1: "b"(10) | 1| failed... 4 <abcd> <c> | 1| 8:REF1: "b"(10) | 1| failed... 3 <abc> <dc> | 1| 8:REF1: "b"(10) | 1| failed... 2 <ab> <cdc> | 1| 8:REF1: "b"(10) | 1| failed... | 0| failed... 2 <ab> <cdc> | 0| 1:OPEN1(3) 2 <ab> <cdc> | 0| 3:REG_ANY(4) 3 <abc> <dc> | 0| 4:CLOSE1(6) 3 <abc> <dc> | 0| 6:STAR(8) | 0| REG_ANY can match 2 times out of 2 +147483647... 5 <abcdc> <> | 1| 8:REF1: "c"(10) | 1| failed... 4 <abcd> <c> | 1| 8:REF1: "c"(10) 5 <abcdc> <> | 1| 10:END(0) Match successful! cFreeing REx: "(.).*\1" DB<4>

In reply to Re: regex step counting by LanX
in thread regex step counting by Random_Walk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.