search

Home  >  Q&A  >  body text

Python正则表达式引用子组匹配有数量限制?

PHPzPHPz2912 days ago367

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-04-18 10:13:42

    Because 10 不是 00.

    The content in your second capture group is 00,当然就不匹配 10 了。引用捕获组的时候,要求此处和指定组是相同的文本,而不是它们符合相同的模式。比如 (.)1 Matches two consecutive identical characters.

    reply
    0
  • 迷茫

    迷茫2017-04-18 10:13:42

    Shouldn’t 00:00:00,000 and 00:00:10:000 just use the same pattern?
    I have run the following pattern on both the website and the Python script you gave me, and it can match.

    (\d{1,3})\n(\d{2}):(\d{2}):(\d{2}),(\d{3}) --> (\d{2}):(\d{2}):(\d{2}),(\d{3})

    reply
    0
  • Cancelreply