Hello Monks!
I'm currently writing many online-gaming related scripts and thought it would be nice to have a routine that extracts clantags out of an array of playernames.
Clantags normally consist of 2 or more characters which are (mostly) at the beginning or end of a name but could also be somehere in the middle.
Normally all players of one team should have the tag in their names so i basically have to find them by seeking and extracting the similaritys.
My problem is: i have no real idea how to do that ;)
I already searched CPAN and found modules like String::Similarity and Algorithm::Diff but none of them seem to help me with my problem since i have to match more than 2 strings in order to find the right tag (Some players might be wearing no/ a different tag).
I already thought of splitting the string into substrings (with String::Substrings) and comparing the resulting arrays but that seems to be the solution with the most overhead.
I hope one of you can point me to a more efficient solution.
Some example player names could be:
jP|Azrael
jP|Blade
jP|Henry
(Clantag: jP|)
Jeff.ocr
pr!me.ocr
Lokren.ocr
(Clantag: .ocr)
Thanks in advance,
Braindead_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.