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
As I did on JS implementation, I recreate the issue there to discuss about "multiple" function.
Some implementation return the given value with "+", other give "{2,}"
To my side, for Go, I developped a method that have this implementation:
multiple(string value, int min, int max)
where:
min is the minimum number of occurence to get
maw is the maximum number of occurence to get
both argument are, IMHO, not required, default should be considered as doing "value?"
This is how I did:
// get "foo" at least one time
v.Multiple("foo")
v.Multiple("foo", 1)
// get "foo" 0 or more times
v.Multiple("foo", 0)
//get "foo" 0 or 1 times
v.Multiple("foo", 0, 1)
// get "foo" 0 to 10 times
v.Multiple("foo",0 ,10)
//get "foo" at least 10 times
v.Multiple("foo", 10)
//get "foo" exactly 10 times
v.Multiple("foo", 10, 10)
//get "foo" from 1 to 10 times
v.Multiple("foo", 1, 10)
Good idea.
But the default by calling v.Multiple("foo") I think should maybe be "0 or more times" or "1 or more times". It's in the name, multiple should be multiple times, otherwise one could use v.Then("foo") ? What do you think?
Good idea.
But the default by calling v.Multiple("foo") I think should maybe be "0 or
more times" or "1 or more times". It's in the name, multiple should be
multiple times, otherwise one could use v.Then("foo") ? What do you think?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-22446495
.
I have to think about it. Let me some minutes
Le 10 août 2013 22:13, "Peder Søholt" notifications@github.com a écrit :
Good idea.
But the default by calling v.Multiple("foo") I think should maybe be "0 or
more times" or "1 or more times". It's in the name, multiple should be
multiple times, otherwise one could use v.Then("foo") ? What do you think?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-22446495
.
"Multiply" method is a "common" method that can be parametric... Instead of testing wich verb to use, a developper can use "Multiply" to set a "variable" minimal number of occurence to fetch.
Without any "min" value, "Multiply" is (IMHO) at least 1 time, so (again IMHO):
Ok, I did all the work on Go implementation + unittest that covers 100%.
But, as I said, my "multiple" method implements what I exposed on this discussion...
Please, others managers, can you vote and tell if you agree with this, and can you implement this ?
Activity
psoholt commentedon Aug 10, 2013
Good idea.
But the default by calling v.Multiple("foo") I think should maybe be "0 or more times" or "1 or more times". It's in the name, multiple should be multiple times, otherwise one could use v.Then("foo") ? What do you think?
metal3d commentedon Aug 10, 2013
Absolutly right :)
Le 10 août 2013 22:13, "Peder Søholt" notifications@github.com a écrit :
metal3d commentedon Aug 10, 2013
I have to think about it. Let me some minutes
Le 10 août 2013 22:13, "Peder Søholt" notifications@github.com a écrit :
metal3d commentedon Aug 10, 2013
Ok, I have thought about.
I really think Multiply("foo") is "1 or more time"
It is normal that some methods can be the same as Something, Any, Find... because in regexp basics, this exists.
"Multiply" method is a "common" method that can be parametric... Instead of testing wich verb to use, a developper can use "Multiply" to set a "variable" minimal number of occurence to fetch.
Without any "min" value, "Multiply" is (IMHO) at least 1 time, so (again IMHO):
Am I wrong ?
psoholt commentedon Aug 11, 2013
👍 I agree :)
metal3d commentedon Aug 12, 2013
Ok, I did all the work on Go implementation + unittest that covers 100%.
But, as I said, my "multiple" method implements what I exposed on this discussion...
Please, others managers, can you vote and tell if you agree with this, and can you implement this ?
SignpostMarv commentedon Jan 16, 2016
I added some tests on the PHP & JS implementations for verifying the output of
regex->startOfLine()->range(0, 9, 'a', 'z', 'A', 'Z')->multiple('')The JS implementation spits out
'/^[0-9a-zA-Z](?:)*/gm', the PHP implementation spits out'/^[0-9a-zA-Z]+/m'Without any min value, if we're assuming Multiple('foo') == Multiple('foo', 1), wouldn't the most correct test be the PHP version ?