Can you explain me the regulsr expression ...
I can begin to explain it and then pass you off to some explanations in the docs that do a better job than I could.
-
\G Begin a 'global' search (i.e., a search controlled by the /g regex modifier) at the exact position where the previous search left off, or at the start of the string (same as \A) if there was no previous search.
-
(\d{2,3}?) Capture two or three decimal digits. Because the ? 'lazy' match modifier controls matching, try first to capture two digits (normal matching would be 'greedy' and try to grab three).
-
(?(?{ $^N < 32 }) (*FAIL)) If the two digits captured by the immediately previous capture group (see $^N in perlvar) are numerically less than 32, fail that match and go back and try for three digits. Here's where I bail out. See Extended Patterns in perlre and search for the "(?(condition)yes-pattern)" discussion; also check the Conditional expressions section in perlretut. Check Special Backtracking Control Verbs in perlre for info on (*FAIL); see also the Backtracking control verbs discussion in perlretut. (Note that (*FAIL) can be replaced by (?!) if you're scared by the "WARNING: These patterns are experimental and subject to change..." language prefacing documentation of these verbs.)
HTH.
-
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 How to display code and escape characters
are good places to start.
|