Re: Need help with RegExpr for Find and Replace in Table attributes
- --- In firstname.lastname@example.org, "Wiz Feinberg" <wizcrafts@...>
> I need a RegExpr to use in a search and replace box to run on each
> these problems, to fix them on an entire page. So far, all I came upinclude
> with for the find field is:
> Which finds and highlights the entire table tag.
> I don't know how to address the replace field so that it will
> <TABLE height="100%" cellSpacing=0 cellPadding=0 width=650I'd suggest you look up HTML clip code in the NoteTab help to begin
> align=center background=images/bg.gif border=0>
Combined with Find, and select, you could find the entire tag and
extract a given attribute without using a regexp.
THEN you could use RegExp in an IfMatch command to extract the
desired value, and reassemble the netire tag and paste it back over
the selected tab.
There are a lot of details in this, and your going to have to deal
with them individually.
- 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