A few examples:
- “ilikestackoverflow” would match “i like stackoverflow”
- “thisisanotherexample” would match “this is another example”
I realize I could remove the spaces on the right hand to match the left hand, but I would save significant space and processing time by being able to go from left to right.
It would only be quicker to remove the spaces on the right side than having the regex parser (something like a state machine) trying every single combination and backtracing everytime.
Does
A BCmatchABC?The regexp could be
^A\s?B\s?C$?meaning 0 or 1)Comparing two strings is much, much lighter and will be faster.