we had a similar question not long ago:
Using special characters in left part of a regex match?
In short: It's not easy!!!
I'm not sure how efficient it is but I might try to code all possibilities into a long or-clause
/(12345x|1234x6|123x56|123x6| ...)/
please note that from 5.10 on such expressions are efficiently trie-optimized.
Another approach could be to match all "x" and surrounding n bytes to be further investigated...
edit
something like /(1 [2-5]{0,4} x [2-5]{0,4} 6)/gx in a while loop to narrow the set of possible matches.
Cheers Rolf
( addicted to the Perl Programming Language)
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.