Interesting.
Here is one example of what this does:
testing: "k5bai"
0: ^.5BAI$
1: ^K.BAI$
2: ^K5.AI$
3: ^K5B.I$
4: ^K5BA.$
5: .*5BAI\z
6: ^K5ABI\z <-N2 error
7: ^K5BIA\z <-N2 error
8: ^K5IBA\z <- really bad
9: ^K5AIB\z
10: ^KB5AI\z
11: ^K5BA\z
12: ^K5BI\z
13: ^K5AI\z
14: ^K5B\z
my regex = (^.5BAI$)|(^K.BAI$)|(^K5.AI$)|(^K5B.I$)|(^K5BA.$)|(.*5BAI\z
+)|(^K5ABI\z)|(^K5BIA\z)|(^K5IBA\z)|(^K5AIB\z)|(^KB5AI\z)|(^K5BA\z)|(^
+K5BI\z)|(^K5AI\z)|(^K5B\z)
Instead of running for each @tokens, I suspect that it would be faster to run the regex against a single string of the concatenation of all of the tokens.
I haven't thought about this code for many moons. Time for a re-think.
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.