|Pathologically Eclectic Rubbish Lister|
searching for stringsby steph_bow (Pilgrim)
|on Aug 06, 2007 at 09:12 UTC||Need Help??|
steph_bow has asked for the
wisdom of the Perl Monks concerning the following question:
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
Here is the output file I would like :
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)