Find html attributes containing apostrophes with regex (notepad ++)

Solved (see first comment from "justhalf")

**

I know that using RegEx for messing with HTML is evil.

However, my means and know-how are limited, and I do not know what else to do.

The situation is as follows:

I have a website containing about 5,000 pages.

There are some errors that I would like to fix:

Such things: <a href="foo" alt='The queen attendants ate the cake.' id='yee'>

The error in this example is that the value for the HTML attribute "alt" is enclosed in apostrophes, but the text also contains an apostrophe. There must be many errors of this type. I want to find them all and fix it.

I tried this with this template { [a-zA-Z].*?='[^'].*?'[^=>].*?'}::

: , HTML ([a-zA-Z].*?), = (='[^'].*?'). HTML. HTML, , , , a > HTML. , HTML, , ([^=>].*?'), , = > , . , any = > .

, HTML, HTML > HTML. .

, , :

class='noteTag' href='

id='fnt-14' name='

... HTML, .

, [^=>].*?'

.

+4
1

@justhalf:

Regex [a-zA-Z]*?='[^']*'[^=>]*' :

<a href="foo" alt='The queen attendants ate the cake.' id='yee'>
<a href="foo" alt='The queens''' attendants ate the cake.' id='yee'>
<a href="foo" alt='The queen attendants ate the cake.' >
<a href="foo" alt='The queen attendants ate the cake.'>
<a href="foo" id='yee' alt='The queen attendants ate the cake.'>

, .
. @justhalf comment.

+1

All Articles