Is Java regex an optimization of this particular case?

I wonder how the regular expression works, my specific regular expression has an element that looks like this:

(word1|word2|wordn......)

The numbers of words are large several hundred .
I am wondering if the regex engine just checks the words one by one or optimizes the search and how.
Any pointer to good documentation would be good.

+5
source share
3 answers

, . .
setValue set|setValue, , "set", .

. ( www.regular-expressions.info).

, (.. nfa ). , , , .

, , . (set|setValue)$, , , .

+1

.
Javaworld java regexp ( NFA NFA). . .

+1

, RE , trie .

+1

All Articles