suggestion : use macro when constant expression
Hi, this looks like a cool idea, Since in many situation regular expression use constant strings a macro could generate the regular expression at compile time. I guess it is already possible to do on top of your library but just thinking it could be a good adition to it too.
Yes I have been thinking of this too, it would be awesome. But I'm not sure how to do this exactly yet. Ideas?
Did not have much a thought, and it might not be trivial. My first thought would be to chain a serie of macro static function with the same name (startOfline, then...) which will return a regexp expression
var regExpr = VerbalMacro.regexp().startOfLine()
.then()
.maybe("s")
.then("://")
.maybe("www.")
.anythingBut(" ")
.endOfLine();
then with the use static extension the generated regexp could be augmented with the function you use
regExpr.isMatch(url)
@simn suggested this: https://gist.github.com/Simn/01748a98af07128ee166 Ill look into this soon.
Looks great.