I have a text like this:
''Lorem ipsum'' dolor ''sit amet, '' consectetur adipiscing elit.
What I want is to get the sit amet correctly wrapped around with ''
, like this:
''Lorem ipsum'' dolor ''sit amet'', consectetur adipiscing elit.
The problem is that my regular expression selects this:
''Lorem ipsum'' dolor ''sit amet, ''
instead of just this:
''sit amet, ''
and, if that is the case, the text selected is not the text I want to correct. Any help?
EDIT
Sorry, yes, indeed I didn't provided any regexp. The thing is I'm using visual-regexp and visual-regexp-steroids, in other words I'm using the regular expression engine(?) that comes with Python. That's why I didn't provided any.
The regexp ''([^']+), ''
works ok (I still have to check the entire 11MB of text) as suggested by mbork.
''\(.+\), ''
, then non-greedy operators won't help apparently. Maybe try something like''\([^']+\), ''
?''sit 'amet, ''
, won't it?''
sequences to some single character not appearing anywhere in the buffer, then do the transformation, and then convert back. Or just write some Elisp to do what the OP needs. Currently, the problem is underspecified anyway., ''
with'',
, possibly interactively (in case one gets false positives).