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):

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
Post a Comment