Dear Monks,

I am a looking for strings which are similar.
The differences between these strings concern only the last character or the last number.

Furthermore, the differences are + 1 / - 1 for the number

And the differences are + 1 / -1 for the place of the letters in the alphabet
What are the tools to use ?
For example, here is my start file
AAA30 BBC5 SHT12H DAL33B BBC49 AAA31 DAL33A BBC6 SHT12G BBC50

Here is the output file I would like :
AAA30;AAA31 BBC5;BBC6 SHT12H;SHT12G DAL33B;DAL33A BBC49;BBC50 AAA31;AAA30 DAL33A;DAL33B BBC6;BBC5 SHT12G;SHT12H BBC50;BBC49

Update :

1) Thanks a lot for your answers, that's very nice of you

2) for the names whose last characters are numbers, for example, AAA30, I would like to look for the AAA29 and the AAA31, and for the NB6, I would like to search for NB5 and NB7.
There are only at maximum two numbers that may change

3)for the names whose last characters are letters, they end with one or two letters

4)if there is only one letter at the end, then I look for the letters next to the one in the order of alphabet for example, if it is AU33H, I would like to look for AU33G and AU33I

5)if there are two letters at the end, then it is only the first one that will change and it is also a letter that will be very close in the order of alphabet for ex : DLH4KF : I would like to look for DLH4JF and DLH4LF

6)there are no negative numbers

7)when a string ends by Z or 99, there is no need to look AA, or 100, ...

8)the length of the string of the couple looked for must be the same (it excludes cases such as the couple ABF99 / ABF100)

In reply to searching for strings by steph_bow

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.