跳到主要内容

Regular Expression

提示

Source of truth by testing.

Word Boundary Marker

\b is used to mark the boundary of a word. But when put besides a non-word, it matches if it's at boundary with a word. It's definition is given as

(^\w|\w$|\W\w|\w\W)

So for example, "a#\b" matches "a#a" but not "a# ".

And \w is [a-zA-Z0-9_].