相关疑难解决方法(0)

用于检测未用双引号括起来的字符串的正则表达式

我有一个像这样的字符串

"quick" "brown" fox jumps "over" "the" lazy dog

我需要一个正则表达式来检测没有用双引号括起来的单词.经过一些随机尝试,我发现了这个("([^"]+)").这会检测用双引号括起来的字符串.但我希望相反.在试图扭转上面提到的正则表达式后,我真的无法想出它.正则表达式我很弱.请帮我

regex

11
推荐指数
1
解决办法
7218
查看次数

帮助构建一个正则表达式

我需要构建一个正则表达式,只有当它不是某个字符串的一部分时才会找到单词"int".

我想找到是否在代码中使用int.(不是在某些字符串中,仅在常规代码中)

例:

int i;  // the regex should find this one.
String example = "int i"; // the regex should ignore this line.
logger.i("int"); // the regex should ignore this line. 
logger.i("int") + int.toString(); // the regex should find this one (because of the second int)
Run Code Online (Sandbox Code Playgroud)

谢谢!

java regex

6
推荐指数
1
解决办法
116
查看次数

标签 统计

regex ×2

java ×1