Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
It attemps to match and backtracks when it can't find a match. Here's a sample of the matches (one per line) the regexp engine attempts.
1) a*->"a"x61, a*->"", a*->"", a*->"", ... a*->"", [b]->fail 2) a*->"a"x60, a*->"a", a*->"", a*->"", ... a*->"", [b]->fail 3) a*->"a"x60, a*->"", a*->"a", a*->"", ... a*->"", [b]->fail 4) a*->"a"x60, a*->"", a*->"", a*->"a", ... a*->"", [b]->fail . . . 32) a*->"a"x60, a*->"", a*->"", a*->"", ... a*->"a", [b]->fail 33) a*->"a"x60, a*->"", a*->"", a*->"", ... a*->"", [b]->fail 34) a*->"a"x59, a*->"aa", a*->"", a*->"", ... a*->"", [b]->fail 35) a*->"a"x59, a*->"a", a*->"a", a*->"", ... a*->"", [b]->fail 36) a*->"a"x59, a*->"a", a*->"", a*->"a", ... a*->"", [b]->fail . . . 64) a*->"a"x59, a*->"a", a*->"", a*->"", ... a*->"a", [b]->fail 65) a*->"a"x59, a*->"a", a*->"", a*->"", ... a*->"", [b]->fail 66) a*->"a"x59, a*->"", a*->"aa", a*->"", ... a*->"", [b]->fail 67) a*->"a"x59, a*->"", a*->"a", a*->"a", ... a*->"", [b]->fail . . . 95) a*->"a"x59, a*->"", a*->"a", a*->"", ... a*->"a", [b]->fail . . .

The character class [b] is necessary because a plain b would trigger optimizations in the regexp engine. The optimization would cause it to scan for the location of b chars in the string to match. Finding none, it would exit immediately.

In reply to Re: slow regular expressions by ikegami
in thread slow regular expressions by jesuashok

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2022-05-18 04:09 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (68 votes). Check out past polls.