Does anyone know how to use regex to capture patterns?
I am coming from many years of php background, in php its pretty much straight forward preg_match($pattern, $subject, $matches);
and then you get all your matches in the $matches array
How do I do somethink like that in Java?
Let's say I want to capture words
'truck' and 'old' from the string "old man trucking in an old truck'
What I need it to get back array or set with words 'truck' and 'old' but not trucking
I would use the \w modifier to make sure I capture on word boundries
Can anyone help me here?