You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let ex2 ="foo".find(re("(?<foo>foo)(?<bar>bar)?"))
doAssert ex2.captures["bar"] ==nil
In this example, captures cannot return nil as nil is used to represent the empty string. The distinction between "no match" and "empty match" is significant and useful when it comes to regular expressions.
The text was updated successfully, but these errors were encountered:
other std libraries had the same issue after the not-nil string change.
what do you suggest for ease of migration? #8638 would help assess impact of such change
A possible option for nre might be to have captures[] throw an exception when attempting to access an undefined capture, and provide some sort of API to detect if a capture exists (e.x. "foo" in captures or 4 in captures).
It'd still be necessary to figure out what the correct return type for captures.toSeq (and captures.toTable) would be, although there are still issues with nim-lang/RFCs#512 there. I'm leaning towards returning seq[Option[string]] there, but there might be some other way to do it.
In this example, captures cannot return nil as nil is used to represent the empty string. The distinction between "no match" and "empty match" is significant and useful when it comes to regular expressions.
The text was updated successfully, but these errors were encountered: