How to Select all chars between 2 html tags?

Find, replace, find in files, replace in files, regular expressions

How to Select all chars between 2 html tags?

Postby SkyGaZeR » Mon Jan 24, 2005 7:05 pm

Hey
How to select all characters between 2 html table tags and then capitalize
the first letter of each word. Likely I need a macro with a
"reg-ex find/select" and then a simple F5 key?

The exact tags are
<tr><td>text in here</td><td>
Want Output of
<tr><td>Text In Here</td><td>

Thank you'
Sky'
User avatar
SkyGaZeR
Newbie
 
Posts: 3
Joined: Mon Jan 24, 2005 12:00 am

Re: How to Select all chars between 2 html tags?

Postby Mofi » Tue Jan 25, 2005 2:32 am

The following macro should do the job. It will not work correctly, if the column text contains '<' or '>', but this should be no problem, because for < and > as text the corresponding html entities should always be used.

Attention! It also capitalize html entities, if the entities are not correct defined - & must be the word starting character and not a delimiter.

InsertMode
ColumnModeOff
HexOff
UnixReOff
Loop
Find RegExp "<td>[~<>]+</td>"
IfFound
ToCaps
Else
ExitLoop
EndIf
EndLoop
Top
Find MatchCase "<Td>"
Replace All "<td>"
Find MatchCase "</Td>"
Replace All "</td>"
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How to Select all chars between 2 html tags?

Postby palou » Tue Jan 25, 2005 2:40 am

If the tag is ever <td>...</td>, use this macro

Code: Select all
InsertMode
ColumnModeOff
HexOff
UnixReOn
"~@#"
Top
Find "<td>"
Key RIGHT ARROW
Key LEFT ARROW
StartSelect
Find Select "</td>"
Key Ctrl+LEFT ARROW
Key Ctrl+LEFT ARROW
Key Ctrl+LEFT ARROW
ToCaps
EndSelect
Top
Find "~@#"
Delete
User avatar
palou
Basic User
Basic User
 
Posts: 46
Joined: Fri Dec 17, 2004 12:00 am
Location: Geneva / Switzerland

Re: How to Select all chars between 2 html tags?

Postby SkyGaZeR » Sat Jan 29, 2005 7:34 pm

Thanks alot. Both did the trick!
User avatar
SkyGaZeR
Newbie
 
Posts: 3
Joined: Mon Jan 24, 2005 12:00 am

Re: How to Select all chars between 2 html tags?

Postby avnik » Sat Jul 11, 2009 5:59 pm

I tried the above example onto mine but it didn't work.
I am trying to select all text in between these 2 tags
<td id="lyrics" "class="song_text">
and
</td>

Trying to copy it and then select the whole page and then paste and then save the file. I tried this macro but it isn't working.

Code: Select all
InsertMode
ColumnModeOff
HexOff
UnixReOff
Find RegExp "^<td id="lyrics" "class="song_text"^>*^</td^>"
Copy
SelectAll
Paste
Save

I know the 'copy' is wrong here. I also tried start select and end select but that didn't work either. Any help here please
User avatar
avnik
Newbie
 
Posts: 3
Joined: Sat Nov 03, 2007 11:00 pm

Re: How to Select all chars between 2 html tags?

Postby Mofi » Sun Jul 12, 2009 7:16 am

Looks like you are using an older version of UltraEdit where the most powerful regular expression engine - the Perl engine - is not available.

There is no need to escape < and > with ^ because <> are not regular expression characters for the UltraEdit engine. But * means 0 or more characters except new line characters. So using * limits your search to single lines. If you want to select a block, use following macro:

UnixReOff
Find MatchCase "<td id="lyrics" "class="song_text">"
IfFound
StartSelect
Find MatchCase Select "</td>"
EndSelect
EndIf
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How to Select all chars between 2 html tags?

Postby avnik » Sun Jul 12, 2009 9:30 am

thanks mofi it worked!!
User avatar
avnik
Newbie
 
Posts: 3
Joined: Sat Nov 03, 2007 11:00 pm


Return to Find/Replace/Regular Expressions