正则表达式在 java 中失败
Regular Expression is failing in java
我有一个以 %payslip%.xml.gpg.
开头的文件名
以下是可能的文件名示例:
Taswkly_payslips_Pay27.xml.gpg
exec_payslip.xml.gpg
Cairns_payslips_adv_P27.xml.gpg
你能帮我建议一下上述模式名称的正则表达式吗?
在上面的模式中,下面的事情是固定的,即
*payslip*.xml.gpg.
如有任何帮助,我们将不胜感激。
您可以使用这个正则表达式:
^.*payslip.*\.xml\.gpg$
^ start of the line
.* any character multiple times
payslip the string "payslip"
.* any character multiple times
\. the "." character
xml the string "xml"
\. the "." character
gpg the string "gpg"
$ end of the line
另外别忘了在java
中转义
^.*payslip.*\.xml\.gpg$
我有一个以 %payslip%.xml.gpg.
开头的文件名以下是可能的文件名示例:
Taswkly_payslips_Pay27.xml.gpg
exec_payslip.xml.gpg
Cairns_payslips_adv_P27.xml.gpg
你能帮我建议一下上述模式名称的正则表达式吗?
在上面的模式中,下面的事情是固定的,即
*payslip*.xml.gpg.
如有任何帮助,我们将不胜感激。
您可以使用这个正则表达式:
^.*payslip.*\.xml\.gpg$
^ start of the line
.* any character multiple times
payslip the string "payslip"
.* any character multiple times
\. the "." character
xml the string "xml"
\. the "." character
gpg the string "gpg"
$ end of the line
另外别忘了在java
中转义^.*payslip.*\.xml\.gpg$