正则表达式匹配句子 Java
Regex match sentence Java
需要正则表达式来按单个单词匹配句子
句子:
"The following program, IfElseDemo, " +
"assigns a grade based on the value of a test score: " +
"an A for a score of 90% or above, a B for a score of 80% or above, and so on"
模式词:IfElseDemo
尝试过:"[^.]* IfElseDemo,\s [^.]*"
但它对我不起作用。
试试这个 /.*IfElseDemo.*/g
你可以查看这个here
需要正则表达式来按单个单词匹配句子
句子:
"The following program, IfElseDemo, " + "assigns a grade based on the value of a test score: " + "an A for a score of 90% or above, a B for a score of 80% or above, and so on"
模式词:IfElseDemo
尝试过:"[^.]* IfElseDemo,\s [^.]*"
但它对我不起作用。
试试这个 /.*IfElseDemo.*/g
你可以查看这个here