Coder Social home page Coder Social logo

Comments (7)

mpkorstanje avatar mpkorstanje commented on June 24, 2024

The idea that the \( and \) go together only exists in your head. The alternation is bounded only by spaces.

Compare:

\(b c/d\)
some rat/cats

Just because there is an s or ( at the start, it doesn't mean that the s or ) at the end is paired with it .

from cucumber-expressions.

mpkorstanje avatar mpkorstanje commented on June 24, 2024

Maybe a better question, since the locally/globally isn't captured, why even mention it? Or use "globally or locally" to make it clear that it doesn't matter.

from cucumber-expressions.

mattwynne avatar mattwynne commented on June 24, 2024

In fact the locally/globally is captured (or at least was), so this isn't the right expression anyway for the particular problem at hand, but that's not really the point.

I was just surprised by the behaviour and thought it might be useful to make it less surprising.

The alternation is bounded only by spaces.

That's the rule I was questioning. Maybe it's more sensible to have it bound by any non-word character? I can just about imagine people wanting to write I have eaten {int} cucumbers/carrots, {int} apples/pears and having the same problem with the comma. The intent there would clearly be (?:cucumbers|carrots) not (?:cucumbers|carrots,)

(Personally I can't remember when I last used a comma in a Gherkin step, but hopefully it at least illustrates the point. 😀)

from cucumber-expressions.

mpkorstanje avatar mpkorstanje commented on June 24, 2024

Maybe it's more sensible to have it bound by any non-word character?

So any non-word character is [^a-zA-Z0-9_] which probably isn't what you mean.

There is the P category in unicode for punctuation, and several subcategories to choose from but the Po category that contains the full stop "." also contains the ampersand "&" so that doesn't work either.

There are a few more caveats. But truth be told, I don't think we can sensibly define the bounds of a alternation beyond space in a way that doesn't involve writing our own multi-language table of characters. And even if we could, we'd have to explain it to people. And then we'd lose the advantage of having a simpler form of regular expressions. So if this is what you want, use a regex. :)

https://en.wikipedia.org/wiki/Unicode_character_property#General_Category

https://www.fileformat.info/info/unicode/category/Po/list.htm

from cucumber-expressions.

mattwynne avatar mattwynne commented on June 24, 2024

Maybe it's more sensible to have it bound by any non-word character?

So any non-word character is [^a-zA-Z0-9_] which probably isn't what you mean.

That is exactly what I meant, yes! You seem to be saying that obviously wouldn't work but I can't see why. What did I miss?

from cucumber-expressions.

mpkorstanje avatar mpkorstanje commented on June 24, 2024

Не все пишут на латыни. Ή αγγλικά για αυτό το θέμα. そして、ガーキンは多くの言語で動作します。Y realmente, incluso el español tiene algunos caracteres que no son palabras en medio de sus palabras.

from cucumber-expressions.

mattwynne avatar mattwynne commented on June 24, 2024

🤦

from cucumber-expressions.

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.