正则表达式中的模式序列无效 [英] Invalid pattern sequence in regex
本文介绍了正则表达式中的模式序列无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这段代码:
Pattern.compile( ^ [SFTG] \d {7} [AZ] $);
我收到此错误:
^ [SFTG] \d {7}中的转义序列无效[AZ] $
如何解决此错误?
解决方案
);
我收到此错误:
^ [SFTG] \d {7} [AZ]
中的无效转义序列>
如何解决此错误?
请参阅:逃避特殊字符 [ ^ 一>
I have this code:
Pattern.compile("^[SFTG]\d{7}[A-Z]$");
And I get this error:
Invalid escape sequence in ^[SFTG]\d{7}[A-Z]$
How can I solve this error?
解决方案
");
And I get this error:
Invalid escape sequence in ^[SFTG]\d{7}[A-Z]
How can I solve this error?
See this: Escape special characters[^]
这篇关于正则表达式中的模式序列无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文