|
regular expressions and string matching
Hi everyone,
Here is my problem, I have a partially decrypted piece string which would appear something like.
Partially deycrpted: the?anage??esideshe?e
Plain text: themanagerresideshere
So you can see that there are a few letter missing from the decryped text. What I am trying to do it insert spaces into the string so that I get:
The ?anage? ?esides he?e
I have a method which splits up the string in substrings of varying lengths and then compares the substring with a word from a dictionary (implemented as an arraylist) and then inserts a space.
The problem is that my function does not find the words in the dictionary because my string is only partially decryped.
Eg: ?anage? is not stored in the dictionary, but the word “manager” is.
So my question is, is there a way to build a regular expression which would match the partially decrypted text with a word from a dictionary (ie - ?anage? is recognised and “manager” from the dictionary).
|