If this is a serious question please provide more details about your application, and the data's context.
I assume that you want to match data in the form of those three individual strings.
- Your first string can be matched easily enough:
/[A-Z]-\w+-[A-Z]-\w+-\w+ \w+/
- Your second string requires more advanced knowledge of your data, and what to look for to determine the boundaries.
- The third is also fairly easy (I'm assuming that the first and last strings always match):
/([0-9A-Z]{5,5})_[0-9A-Z]{5,5}_\1/
This code is just off the top of my head, but the basic idea should be plain. Clearly we'd have to know more about the variations allowed for the data, and the data that we need to *avoid* matching.
You can always combine multiple searches into one giant 'or' fest, /search1|search2|search3/. However that's much more confusing to read, harder to debug, and much slower than individual searches.
With a deep knowledge of your data, and what you are trying to match, you *might* be able to create an aggregate reg-ex that was more efficient than three searches, but probably not.
Ardemus - "This, right now, is our lives."
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.