[英]Trying to match line with regular expression
I am trying to match the following line: 我正在尝试匹配以下行:
801. Our origination charge (Includes Originat ion Point (s) % or $ ) (f rom GFE #1)$ 1,169.00
I have created this regular expression: 我创建了这个正则表达式:
.*801\\..*\\(f\\s?rom.*$\\s?(.*)
What this should do is: 这应该做的是:
The way I believe this breaks my string down is like so: 我相信这会破坏我的思路,就像这样:
However this is not the case. 然而,这种情况并非如此。 My regular expression does not match this string.
我的正则表达式与此字符串不匹配。 Any ideas why?
有什么想法吗?
.*801\..*\(f\s?rom.*\$\s?.*
Escape the $ character. 转义$字符。 And remove the brackets in the end.This regex exactly matches the string.
并删除最后的括号。此正则表达式与字符串完全匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.