groovy - How to find all matches of a pattern in a string using regex -


if have string like:

s = "this simple string 234 else here 4334 

and regular expression like:

regex = ~"[0-9]{3}" 

how can extract words string using regex? in case 234 , 433?

it's shorter do

def triads = s.findall("[0-9]{3}")  assert triads == ['234', '433'] 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

What is happening when Matlab is starting a "parallel pool"? -

php - Cannot override Laravel Spark authentication with own implementation -