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
In some cases it's true! VE is mostly for those who don't know how to type simple regex. Or where you should write something that should be human-readable (for example in tests).
You are right, sometimes regex is better than ve, principally for those who know regex enough. But we have a lot of thing to improve our code, whatever we use.
Activity
lanwen commentedon May 23, 2017
Can't see why your variant better than original
dawnbreaks commentedon May 24, 2017
@lanwen It 's ridiculous to list all the Word char and all digit char in the sring parameter in the anyOf method.
lanwen commentedon May 24, 2017
lib already has
.wordChar().nonWordChar().space().nonSpace().digit().nonDigit()use with
.capture().endCapture()- is it solve your case?dawnbreaks commentedon May 24, 2017
No. Please tell me how to use verbalExpressions to represent this regex: [a-k\s\d,]+
lanwen commentedon May 24, 2017
regex().add("[").wordChar().space().digit().add("]").oneOrMore()regex().anyOf("\\w\\s\\d")regex().capture().digit().or("\\w").or("\\s").endCapture().oneOrMore()regex().add("[a-k\s\d,]+")You can use raw regex if it looks more compact
dawnbreaks commentedon May 24, 2017
I think java regex is more readable than verbal expressions. VE is too awkward to use it.
lanwen commentedon May 24, 2017
In some cases it's true! VE is mostly for those who don't know how to type simple regex. Or where you should write something that should be human-readable (for example in tests).
eduardohmg commentedon Jul 18, 2017
It's some late, but I think with an indentation it can be better:
You are right, sometimes regex is better than ve, principally for those who know regex enough. But we have a lot of thing to improve our code, whatever we use.