anonymous_github icon indicating copy to clipboard operation
anonymous_github copied to clipboard

Regex don't allow matching non-word chars

Open JuliusNmn opened this issue 1 year ago • 1 comments

i want to anonymize javadoc @author with a regex, but my regex @author .* fails to replace them. example:

/** a b c
* @author julius
*/

as i can see in source code, all terms are wrapped in \b tags, which fail to capture the @ character. my workaround was to use author \w.* instead, which works well enough, but might match in places where it shouldn't.

proposed fix: don't wrap a regex in \b if it begins/ends in non-word characters?

JuliusNmn avatar Dec 13 '23 11:12 JuliusNmn

I a aware of this, but the benefits are bigger than the drawbacks. For now, it will stay like this until I find a better solution.

tdurieux avatar Dec 20 '23 12:12 tdurieux