Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Regular Expression to find a tag with a missing attribute.

New Here ,
Jan 23, 2012 Jan 23, 2012

Here's my case, I'm trying to find an <img> tag that has a missing alt property.  how would I write that so that regex in Dreamweaver's find/replace, so that I don't have to review every individual <img> tag, verifying it has an alt property, until I find the tag I'm looking for?

I found a blog article that specifically addressed, this, but the regex didn't work:

<imgs+((width|height|border|class|id|src|usemap|hspace|vspace)=”[^"]+”s*)+/>

(I added the "/" at the end, since my document is XHTML)

TOPICS
Server side applications
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 31, 2012 Jan 31, 2012
LATEST

JeremySeda wrote:

I found a blog article that specifically addressed, this, but the regex didn't work:

<imgs+((width|height|border|class|id|src|usemap|hspace|vspace)=”[^"]+” s*)+/>

(I added the "/" at the end, since my document is XHTML)

I haven't studied the regex in detail, but there are two obvious errors in it. There should be a backslash before the "s" after "img". Also, the forward slash that you added at the end should also be preceded by a backslash.

However, there is no need to go to such lengths to find missing "alt" text. In Dreamweaver, select Site > Reports. The dialog box that opens has options that will let you check for missing "alt" text in the current document, a specific folder, or even the whole site. Just click Run to get the report.

site_report.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines