Closed sirthias closed 7 years ago
@sirthias Are you aware of a regex precompiler for Scala/Java?
EDIT: nvm, just noticed the compile
method. Will have a look into this.
Okay I have just pushed this, according to the Scala docs the .r
method on String
s return a compiled regex
Currently
jNumberRegex
is a simpleString
, which means that for every application of the regex, i.e. every creation of aJNumber
instance from aString
the regex has to be compiled before it is run.IMHO the regex should be precompiled or, even better, turned into a manual check.
Of course one could also debate whether the check is really necessary at all, since
JNumber
instances will typically be created either by a parser or by one of the non-stringJNumber.apply
overloads, which will never created illegal number strings anyway.