Page 1 of 1
Find img tag to add ALT Attribute when necessary
Posted: Mon Oct 17, 2005 6:48 pm
I want to find <img> tag that DONT Contains ALT, and when found add ALT="".
The tags that contains an attribute MUST remain unchanged of course...
Thank you for help
Posted: Wed Nov 30, 2005 12:25 pm
The task is solvable with Advanced Find and Replace.
One small inconvenience: in classical regular expressions there is no
"does not contains" operator for lateral strings.
But AFR can do the task any way in 3 steps.
Go to main menu - Action - Options - Batch Replace
check "Modifier S"
Go to Batch replace tab, check on "Use regular expressions".
Put into the grid 3 rows:
Press Execute button.
That's all I verified it works perfectly.
With first search/replace pair we temporarily rename <img> tag already
having "alt" with new tag name: <temp_img
Then with second search/replace pair we add alt="" to all <img> tags
which don't having yet alt tag.
With the third search/replace pair we rename back <temp_img into <img