Regular expression to remove links

Possible duplicate:
Open RegEx tags, with the exception of stand-alone XHTML tags

I have an HTML page with

<a class="development" href="[variable content]">X</a>

[variable contents] is different in every place, the rest is the same.
What will regexp catch all these links? (Although I am not writing here, I really tried ...)

+5
source share
5 answers

How about a non-greedy version:

<a class="development" href="(.*?)">X</a>
+3
source

Try this regex:

<a class="development" href="[^"]*">X</a>
+4
source

Regexes HTML (. , XML HTML ? ). HTML. . HTML ? .

+4

Regex, , HTML, , , . , ,

<a class="development" 
  href="[variable content]">X</a>

<a class="development" href="[variable content]">X
</a>

?

JQuery, :

$("a.development").onclick = function() { return false; }

$("a.development").attr("href", "#");
+1

, href.

/<a class="development" href=(?:"[^"]*"|'[^']*'|[^\s<>]+)>.*?<\/a>/m

I also assume that it Xwill be a variable, so I added a non-greedy match to handle it, which /mmeans .also matches line breaks.

+1
source

All Articles