To find out all the occurrences of texts matching a regular expression®, e.g. 101 against a large chunk of text(T), what can the most efficient algorithm be? Had R been a fixed pattern, KMP/Boyen-Moore/RK could be the solution.
O(|R| + |T|), using for example kmp