regex - My regular expression matches too much. How can I tell it to match the smallest possible pattern? -


i have regex:

('.+') 

it has match character literals in c. example, if have 'a' b 'a' should match a's , ''s around them.

however, matches b (it should not), because is, strictly speaking, between ''s.

here screenshot of how goes wrong (i use syntax highlighting):
screenshot

i'm new regular expressions. how can tell regex not match this?

it being greedy , matching first apostrophe , last 1 , in between.

this should match isn't apostrophe.

('[^']+') 

another alternative try non-greedy matches.

('.+?') 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -