When doing a regular expression you have to do 3 at least lines of code
matcher := Regex <|<regexp>|>.matcher(<matchto>) matcher.matches <res> := matcher.group(<group num>)
while in for example in python you can just do
<res> = re.search(<regexp>, <matchto>).group(<group num>)
<regexp>
So I suggest the addition of function "match" to the Regex class, which would allow to do the following
<res> := Regex <|<regexp>|>.match(<matchto>).group(<group num>)
and with the power of fantrom in case there is no match
<res> := Regex <|<regexp>|>.match(<matchto>).?group(<group num>)
Not that we shouldn't consider a convenience method, but you can actually do it all with one line of code:
Regex<|...|>.matcher("....") { matches }.group(num)
sorry, but thanks for the answer
Login or Signup to reply.
jessevdam Tue 26 Jul 2011
When doing a regular expression you have to do 3 at least lines of code
while in for example in python you can just do
<res> = re.search(
<regexp>
, <matchto>).group(<group num>)So I suggest the addition of function "match" to the Regex class, which would allow to do the following
and with the power of fantrom in case there is no match
brian Tue 26 Jul 2011
Not that we shouldn't consider a convenience method, but you can actually do it all with one line of code:
jessevdam Wed 27 Jul 2011
sorry, but thanks for the answer