Select text between quotes

Help with writing and playing macros

Select text between quotes

Postby OlegEF1 » Thu Jul 21, 2011 3:29 am

Could you please help with a macro which selects text between quotes ("|') (excluding quotes)?
I've written a macro which selects text, but it includes the quotes.

Thx
OlegEF1
Newbie
 
Posts: 2
Joined: Thu Jul 21, 2011 3:26 am

Re: Select text between quotes

Postby Mofi » Thu Jul 21, 2011 9:54 am

A very quickly created version.

InsertMode
ColumnModeOff
HexOff
UnixReOff
Find RegExp "["']"
IfFound
Find RegExp "[~"']+"
EndIf

That macro does not take escaped quotes into account. And the caret should never be set inside a string on execution.

The Perl regular expression experts perhaps find better solutions than this simple approach with UltraEdit regular expression engine.

BTW: If you need that macro only for selecting quickly a string, try double clicking with primary (left) mouse button while Ctrl key is pressed.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Select text between quotes

Postby OlegEF1 » Thu Jul 21, 2011 5:25 pm

Works like a charm!
Thank you very much.

Mofi wrote:And the caret should never be set inside a string on execution.

Modified your macro to select text if caret is inside a string.

InsertMode
ColumnModeOff
HexOff
UltraEditReOn
Find RegExp Up "["']"
IfFound
Find RegExp "[~"']+"
EndIf
OlegEF1
Newbie
 
Posts: 2
Joined: Thu Jul 21, 2011 3:26 am


Return to Macros