Good morning everyone,
I would like to perform a string search for some specific character strings, but in the project we are working with we do not have access to any find
function or similar, only to a regular expression-based substitution function (something like replace(string, regex, replacement)
).
The idea would then be: select all the characters EXCEPT the sequences that I want to find. So I would remove these unwanted characters and compare them to what I want to find.
Example (not a specific language):
string expReg = ??????;
string texto = "xxxxxxxxboloxxxxxxxfarinhaxxxxxxacucarxxxx";
string busca = replace(texto, expReg, "");
if(busca == "bolofarinhaacucar"){
return("Sucesso");
}
Luckily the words we need to find must be in the defined order, so it would not be necessary to include all the permutations.
We tried to find some solution using regular expressions, but we always run into the problem that positive lookbehind (?<=ABC)
is not supported in Javascript.
Any ideas?