[英]Regex word with '.'
I made a regex to find "RTE" word like \\bRTE\\b
我做了一个正则表达式来找到像“
\\bRTE\\b
”这样的“RTE”字样
This work fine at first and last position and middle of string. 这在第一个和最后一个位置和字符串中间很好。
I try to find RTE.( WORD ) whit this \\bRTE\\.\\b
but this not working proprely. 我试着找RTE。( WORD )发布这个
\\bRTE\\.\\b
但这不能正常工作。
Because it not supose to find in a string like this: "RTE.sa" and this is the only case that "work" 因为它没有找到像这样的字符串:“RTE.sa”,这是“工作”的唯一情况
\\b
is a word boundary. \\b
是单词边界。 That is why it is matching RTE.sa
. 这就是它匹配
RTE.sa
。 After the .
之后
.
, you have the start of a word. ,你有一个词的开头。
You are looking for the negated word boundary, which is \\B
. 您正在寻找否定的单词边界,即
\\B
So this regex should work: \\bRTE\\.\\B
所以这个正则表达式应该工作:
\\bRTE\\.\\B
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.