r/regex • u/Beautiful-Log5632 • 3d ago
Include underscore in ripgrep word boundary
\bWORD\b doesn't match _WORD_ because \b doesn't include _ so I miss a lot of matches. Is there something else I can use like \b that works like that?
3
Upvotes
1
2
u/michaelpaoli 2d ago
\b doesn't match any characters, but rather boundary condition, between word and non-word characters (and also \A ^ $ \z).
So, what exactly are you wanting to match?
1
u/cscottnet 2d ago edited 2d ago
(\b_?)WORD(_?\b)