Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在运行声纳,而 checkstyle 有一个像这样的正则表达式规则:
^[a-z][a-zA-Z0-9]*$
我想修改它,以便允许一个或多个下划线。我将如何改变这个?谢谢!
这些是字符类。
如果你想在任何地方允许下划线:
^[a-z_][a-zA-Z0-9_]*$
如果你想在除第一个字符之外的任何地方允许下划线:
^[a-z][a-zA-Z0-9_]*$