In the context of using regexp for matching documents against several keywords it could takes quadratic time (number of documents × number of keywords).
With a set of the following keywords:
['ant', 'antelope', 'albatross', 'alligator']
I would produce the stupid regex:
/ant|antelope|albatross|alligator/
But I'm looking for a solution which convert the set into something like:
/a(nt(|elope)|l(batross|ligator))/
which is quite more efficient