I'm sure this will help you: http://exampledepot.com/egs/java.util.regex/Greedy.html
If you want the shortest possible match you have to make the quantifier non-greedy by adding an ?, like: /.*?fish/g/
I'm sure this will help you: http://exampledepot.com/egs/java.util.regex/Greedy.html
If you want the shortest possible match you have to make the quantifier non-greedy by adding an ?, like: /.*?fish/g/