Comments (7)
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.
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.
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.
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.
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.
Не все пишут на латыни. Ή αγγλικά για αυτό το θέμα. そして、ガーキンは多くの言語で動作します。Y realmente, incluso el español tiene algunos caracteres que no son palabras en medio de sus palabras.
from cucumber-expressions.
🤦
from cucumber-expressions.
Related Issues (20)
- Remove Python example illustrating how to define parameter types HOT 2
- more powerful optional text HOT 12
- Allow free-form text in optionals HOT 1
- Expression for an argument list HOT 4
- Improve Expression creation performance HOT 2
- Use action-publish-pypi in cucumber-expressions
- Optimize Cucumber expression creation in .Net implementation
- Action Required: Fix Renovate Configuration
- Bad CucumberExpression creation performance HOT 6
- Golang big.Float is not a big decimal HOT 12
- Feature: named capture groups HOT 13
- Missing source for source map
- RegEx "expressions" and defineParameterType feature file examples ?
- Add the ability to ignore a cucumber expression parameter just like a non capturing regex HOT 12
- Nested capture groups are not passed to custom param definition transformer HOT 8
- `end` as a method name / prop can cause some issues HOT 4
- LICENSE file is empty HOT 1
- Typo in error message for use of alternation inside an optional
- Unable to parse negative number in Norwegian HOT 11
- Released Ruby gem is missing LICENSE file. HOT 1
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 cucumber-expressions.