试试这个:
pattern = @"\b\d+Z\s+\d+Z\b";
解释:
"
\b # Assert position at a word boundary
\d # Match a single digit 0..9
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
Z # Match the character “Z” literally
\s # Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.)
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
\d # Match a single digit 0..9
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
Z # Match the character “Z” literally
\b # Assert position at a word boundary
"
顺便一提:
\b*
应该抛出异常。\b
是一个词锚。你无法量化它。