Giter Club home page Giter Club logo

Comments (8)

eduardohmg avatar eduardohmg commented on June 29, 2024 1

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.

lanwen avatar lanwen commented on June 29, 2024

Can't see why your variant better than original

from javaverbalexpressions.

dawnbreaks avatar dawnbreaks commented on June 29, 2024

@lanwen It 's ridiculous to list all the Word char and all digit char in the sring parameter in the anyOf method.

from javaverbalexpressions.

lanwen avatar lanwen commented on June 29, 2024

lib already has .wordChar().nonWordChar().space().nonSpace().digit().nonDigit()

use with .capture().endCapture() - is it solve your case?

from javaverbalexpressions.

dawnbreaks avatar dawnbreaks commented on June 29, 2024

No. Please tell me how to use verbalExpressions to represent this regex: [a-k\s\d,]+

from javaverbalexpressions.

lanwen avatar lanwen commented on June 29, 2024

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.

dawnbreaks avatar dawnbreaks commented on June 29, 2024

I think java regex is more readable than verbal expressions. VE is too awkward to use it.

from javaverbalexpressions.

lanwen avatar lanwen commented on June 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.