Scala regex Named Capturing Groups

前端 未结 2 1159
旧巷少年郎
旧巷少年郎 2020-12-10 02:17

In scala.util.matching.Regex trait MatchData I see that there support for groupnames , I thought that this was related to (Regex Named Capturing Groups)

But since J

2条回答
  •  醉酒成梦
    2020-12-10 03:15

    Scala does not have its own imlementation of regular expression matching. Instead the underlying regular expressions are Java's, so the details of writing patterns are those documented in java.util.regex.Pattern.

    There you will find that the syntax you're using is actually that of the look-behind constraint, though according to the docs the < must be followed by either = (positive look-behind) or ! (negative look-behind).

提交回复
热议问题