Is it possible to make non-capturing groups work in scala regexes when pattern matching

后端 未结 2 418
后悔当初
后悔当初 2021-01-18 01:38

As far as I can see from the docs, non-capturing groups are defined by (:? ), as in Java. (I believe it\'s the same underlying library).

However, this doesn\'t seem

2条回答
  •  忘掉有多难
    2021-01-18 02:03

    It seems like you've got the syntax wrong. Should be (?:).

    http://docs.oracle.com/javase/tutorial/essential/regex/groups.html

    Groups beginning with (? are pure, non-capturing groups that do not capture text and do not count towards the group total.

提交回复
热议问题