Hey all. I stink at regexes, so I thought I would grab some help. I would normally use a split to do something like this, but the data isn't always consistent, so I think a regex is my only option. If there are any other options, I'd be happy to hear them.
Here's the dealy....I'm trying to break down a string that can contain several (unknown) instances of 5 pieces of data.
Here's an example of one that contains 3 instances:
value:patternList = "{error 1 1 {^E [0-2][0-9]:[0-5][0-9]:[0-5][0-9].*
+$} {^E [0-2][0-9]:[0-5][0-9]:[0-5][0-9].*$}} {three 1 1 {^.*35=A.*$|^
+.*35=5.*$} {^.*35=A.*$|^.*35=5.*$}} {fixv 1 1 ^.*VFIXFxProxy.*Disconn
+ected ^.*VFIXFxProxy.*Disconnected}"
The first instance starts with "error", the 2nd "three" and the 3rd "fixv". Notice that the fixv instance doesn't have "{}" around the 4th and 5th pieces of data like the other 2 do...this is my problem and why I can't use split. Also note that the lack of "{}" can occur in any of the instances, not just the 3rd.
So...in a nutshell...I'm trying to pull out the 3 instances into an array which I can then split (or use another regex) to get my 5 pieces of data from each.
The data itself is separated by spaces (with data containing a space encompassed with {}), so in instance 1, the 5 pieces would be:
error
1
1
^E [0-2][0-9]:[0-5][0-9]:[0-5][0-9].*$
^E [0-2][0-9]:[0-5][0-9]:[0-5][0-9].*$
I hope this makes sense...it's difficult to explain. Thanks in advance for any help.
CODE tags added by Arunbear
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.