Before trying to explain my problem, I would like to say that I'm not sure its possible to achieve. I'm a bit confused about the whole idea and wanted to hear your thoughts.
Consider the following paths:
/ax/disks/xyz.prdenv.1/tool_utils/asda/15.2.0.5/asda.csh
/tmp_log/site/disks/sad/tool_utr/zensxi/12.01.001a/log/script.pl
I'm trying to build a script which iterates over a disk which is giving as an input and to try to guess which regex I need for catching the group and the version.
For the first path, I can understand that the group is "asda" and the version is "15.2.0.5" and for the second path I can understand that the group is "zensxi" and the version is 12.01.001a.
So the regex for the first path, could be:
/ax/disks/xyz.prdenv.1/tool_utils/(.*?)/(.*?)/.*
The regex for the second path, could be:
/tmp_log/site/disks/sad/tool_utr(.*?)/(.*?)/.*
Is it possible to achieve? that main problem here, is that the version does not have to be all digits.
The reason I need those regexes is for creating an example file which user can give our tool and it will use those regex to filter the wanted paths.
The script I'm trying to build, will suggest all possible combination of regexes so it the user will just have to look into them and choose the best one.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.