更新时间:2022-10-16 14:43:05
当您在正则表达式中重复捕获组时,捕获组仅存储上一次迭代匹配的文本.如果需要捕获多个迭代,则需要使用多个正则表达式. (.NET是唯一的例外.它的CaptureCollection
提供捕获组所有迭代的匹配项.
When you repeat a capturing group in a regular expression, the capturing group only stores the text matched by its last iteration. If you need to capture multiple iterations, you'll need to use more than one regex. (.NET is the only exception to this. Its CaptureCollection
provides the matches of all iterations of a capturing group.