regex : how to eliminiate urls ending with .dtd
Posted
by dorelal
on Stack Overflow
See other posts from Stack Overflow
or by dorelal
Published on 2010-03-31T12:45:26Z
Indexed on
2010/03/31
13:23 UTC
Read the original article
Hit count: 485
regex
This is JavaScript regex.
regex = /(http:\/\/[^\s]*)/g;
text = "I have http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd and I like http://google.com a lot";
matches = text.match(regex);
console.log(matches);
I get both the urls in the result. However I want to eliminate all the urls ending with .dtd . How do I do that?
Note that I am saying ending with .dtd should be removed. It means a url like http://a.dtd.google.com should pass .
© Stack Overflow or respective owner