I'm too lazy to work out a complete solution but a clean approach would be to deparse the regex-compilation:
> perl -e 'use re 'debug';/(?i-xsm:(?<mon>\w+)\s+(?<day>\d+)\s+)/'
Compiling REx "(?i-xsm:(?<mon>\w+)\s+(?<day>\d+)\s+)"
Final program:
1: OPEN1 'mon' (3)
3: PLUS (5)
4: ALNUM (0)
5: CLOSE1 'mon' (7)
7: PLUS (9)
8: SPACE (0)
9: OPEN2 'day' (11)
11: PLUS (13)
12: DIGIT (0)
13: CLOSE2 'day' (15)
15: PLUS (17)
16: SPACE (0)
17: END (0)
stclass ALNUM plus minlen 4
Freeing REx: "(?i-xsm:(?<mon>\w+)\s+(?<day>\d+)\s+)"
Now fetching all /OPEN\d+ '(\w+)'/-opcodes shouldn't be too difficult.
See perldoc re for more options.
UPDATE: shrank example.
-
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.
|