I have simple regex
'\'.*\''
for me its says select everything between ‘ and ‘, but it also catches
'text') != -1 || file.indexOf('.exe'
for me its two strings, for regex its one. how can i make regex to see that its two strings?
P.S. I’m using Java.
That’s the non-greedy form:
The
*?means: ‘Match as little as possible’, while the*alone means ‘Match as much as possible’.The latter basically goes on until the end of the string, giving characters back one by one so the final
'can match. That’s why you get everything between the first and the very last quote in your string.