I was thinking in providing the following regex as an answer to this question, but I can't seem to write the regular expression I was looking for:
w?o?r?d?p?r?e?s?s?
This should match a ordered abbreviation of the word wordpress
, but it can also match nothing at all.
How can I modify the above regex in order for it to match at least 4 chars in order? Like:
- word
- wrdp
- press
- wordp
- wpress
- wordpress
I'd like to know what is the best way to do this... =)
What about php similarity checker functions?
You could use a lookahead assertion:
i know this is not a regex, just for fun...
This won't even run the regexp unless the string is at least 4 chars long.