Comments (8)
It's some late, but I think with an indentation it can be better:
.add("[")
.wordChar().space().digit()
.add("]")
.oneOrMore()
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.
from javaverbalexpressions.
Can't see why your variant better than original
from javaverbalexpressions.
@lanwen It 's ridiculous to list all the Word char and all digit char in the sring parameter in the anyOf method.
from javaverbalexpressions.
lib already has .wordChar().nonWordChar().space().nonSpace().digit().nonDigit()
use with .capture().endCapture()
- is it solve your case?
from javaverbalexpressions.
No. Please tell me how to use verbalExpressions to represent this regex: [a-k\s\d,]+
from javaverbalexpressions.
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
from javaverbalexpressions.
I think java regex is more readable than verbal expressions. VE is too awkward to use it.
from javaverbalexpressions.
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).
from javaverbalexpressions.
Related Issues (20)
- Maven repository HOT 1
- Getting list of matching groups HOT 2
- or() with capture()
- zeroOrMore() and oneOrMore() do not generat correct results HOT 4
- removeModifier() may switch on the flag
- Modifier constants HOT 1
- Javadoc ? HOT 1
- lineBreak() has a capturing group HOT 1
- anythingBut("abb") does not generate correct result when more than 1 character HOT 2
- Binary release HOT 2
- 'capture' and 'or' issue
- or for no string
- Exposing the spans of matches in the API HOT 1
- How do you express [0-9.,] HOT 1
- Named-capturing group doesn't seem to be supported
- Word boundary(\b) support
- How to get the startIndex and endIndex of match results? HOT 1
- Verbal expressions 1.7 not released on maven central
- No lookarounds support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javaverbalexpressions.