Regular expression capturing a repeated group

后端 未结 1 1379
失恋的感觉
失恋的感觉 2020-12-07 05:51

I am trying to parse input string using regular expression. I am getting problem when trying to capture a repeating group. I always seem to be matching last instance of the

相关标签:
1条回答
  • 2020-12-07 06:33

    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.

    0 讨论(0)
提交回复
热议问题