I'm have a project where I need to find occurrences of a string in a large body of text. The search string is known to be present in the larger text, however for reasons beyond my control they are not white-space correct, in that they are missing spaces between some of the words.
For example I the string to find is (not the lack of space between brown and fox:
quick brownfox jumps
And I need to find this in:
The quick brown fox jumps over the lazy dog.
I need to be able to modify the haystack to wrap the found terms with an identifying tag so I'll end up with something like:
The <span class="found">quick brown fox jumps</span> over the lazy dog.
I've looked into using regex in free-spacing mode which seems to not quite do what I need, I considered stripping all white space from the search terms and adding \s* between each character but thought this might have a horrendous effect on performance (can any regex experts could confirm or deny that?).
Are there any possible non-regex solutions to look into.
Thanks