Re: [Clip] Need help with RegExpr for Find and Replace in Table attributes
- Wiz Feinberg wrote:
>For example, here is a table tag that I need to alter:Here are a few ideas, indicating the Clip commands you would want to
><TABLE height="100%" cellSpacing=0 cellPadding=0 width=650
>align=center background=images/bg.gif border=0>
>In this instance I will need to remove the entire height attribute,
>convert the background attribute to an inline style, and add a summary
>attribute. I also want to make all attributes lowercase. The finished
>tag would be like this:
><table cellspacing="0" cellpadding="0" width="650" align="center"
>style="background-image:url(images/bg.gif)" border="0" summary="Layout
>On other tables I only need to add the summary to the end of the
read-up on in order to automate your task.
To select the entire <table ...> tag us this:
^!Find "<table" IS
Having select the tag, you can perform the requred search/replace
commands, for example
^!Replace "height=[^\s]+\s" >> "" RHIS
1. The R indicates the use of a regular expression.
2. The \s stands for a space;
3. The cryptic construction [^\s] means any character BUT the space;
4. The + means one or more instances of the preceding character.
5. Thus the ^!Replace command looks within the selected text for
"height=" followed immediately followed by one or more non-space
character, such as "100%", and a space, and it replaces the combination
with a null string ("").
To add a summary at the end use something like
^!Replace ">" >> "summary="whatever is appropriate">" HS