True when word is one areaSearchexpression value as the Routing API's spec
allows it (^(\*?([^\*]{2,})\*?)*$), decided by one linear scan.
That pattern reads: the word is a sequence of runs of at least 2 non-wildcard
characters (code points), each with an optional * before and after it. Taken by
maximal runs, that is: every run of non-wildcard characters has at least 2 of them;
at most one * before the first run and at most one after the last; one or two
* between two runs. So Mag*, *burg, *ab*, ab*cd and ab**cd pass, and
Ma*g, **ab, ab***cd and * don't. (The empty word matches the pattern too;
it never reaches this check.)
The spec's pattern is not used as a regex: its nested quantifiers backtrack
exponentially when a long run is followed by a misplaced * — a 45-character
Donaudampfschifffahrtsgesellschaftskapitaen*X took 57 s in the CLI and blocked a
service's event loop for as long. This scan takes linear time for any input.
True when
wordis oneareaSearchexpressionvalue as the Routing API's spec allows it (^(\*?([^\*]{2,})\*?)*$), decided by one linear scan.That pattern reads: the word is a sequence of runs of at least 2 non-wildcard characters (code points), each with an optional
*before and after it. Taken by maximal runs, that is: every run of non-wildcard characters has at least 2 of them; at most one*before the first run and at most one after the last; one or two*between two runs. SoMag*,*burg,*ab*,ab*cdandab**cdpass, andMa*g,**ab,ab***cdand*don't. (The empty word matches the pattern too; it never reaches this check.)The spec's pattern is not used as a regex: its nested quantifiers backtrack exponentially when a long run is followed by a misplaced
*— a 45-characterDonaudampfschifffahrtsgesellschaftskapitaen*Xtook 57 s in the CLI and blocked a service's event loop for as long. This scan takes linear time for any input.