Back in 2010, I wrote macro to select HTML tag, which I have been using ever since - but they weren't perfect.
Select previous tag: mapped to control+shift+,
Select next tag: mapped to control+shift+.
The idea is to make easy to run either macro once to select the next/previous tag, and to keep running either macro to select the next/previous open or close. Consider the below example where the | represents the cursor and can be either within the opening DIV tag or the content of the DIV tag.
Run the select previous macro and the opening DIV tag will be selected. Next, run the select next macro and the entire inner DIV will be selected. Run the select previous then select next again and the entire outer DIV will be selected.
I have given this a proper write up on my blog here: UltraEdit macro to select HTML/XML tag.
- They didn't deal correctly with nested tag names that were similar, such as zip vs zipfileset (ant xml).
- It used main clipboard, which isn't nice.
Select previous tag: mapped to control+shift+,
Code: Select all
InsertMode
ColumnModeOff
HexOff
UltraEditReOn
Clipboard 2
IfSel
Find RegExp Up Select "</++^c^{>^}^{[ ^p^r^n^t]+[~>]++>^}"
Else
Find Up "<"
Find RegExp "[A-Za-z]"
SelectWord
Copy
Find Up "<"
Key LEFT ARROW
Find RegExp Select "</++^c^{>^}^{[ ^p^r^n^t]+[~>]++>^}"
EndIf
Clipboard 0
Code: Select all
InsertMode
ColumnModeOff
HexOff
UltraEditReOn
Clipboard 2
IfSel
Find RegExp Select "</++^c^{>^}^{[ ^p^r^n^t]+[~>]++>^}"
Else
Find "<"
Find RegExp "[A-Za-z]"
SelectWord
Copy
Find Up "<"
Key LEFT ARROW
Find RegExp Select "</++^c^{>^}^{[ ^p^r^n^t]+[~>]++>^}"
EndIf
Clipboard 0
Code: Select all
<div>
<div style="color: red;"
id="divWit|hId">Nested| <span>div</span>.
<pre>
monospaced
</pre>
</div>
</div>
I have given this a proper write up on my blog here: UltraEdit macro to select HTML/XML tag.