C#正则表达式匹配返回false

时间:2018-04-06 05:14:18

标签: c# regex

这是我的c#regex匹配代码:

String pa = "(?<year>\\d{2, 4})/(?<month>\\d{1, 2})/(?<day>\\d{1, 2})";
Match match = Regex.Match("2014/03/02", pa);

但是match.success返回false。有什么问题?

2 个答案:

答案 0 :(得分:0)

我已编辑了您的表达式:Dim myAddress As String myAddress = "B1:B" & Cells(Rows.Count, 2).End(xlUp).Row Range(myAddress) = Evaluate("IF(" & myAddress & "="""","""",TRIM(" & myAddress & "))")

在此测试:https://regex101.com/r/cJ4sxi/1

答案 1 :(得分:-1)

问题是您的{2, 4}{1, 2}量词中的空格。