Thread: Regex examples
View Single Post
Old 09-25-2012, 09:48 AM   #133
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by paulfiera View Post
Most surely, I'm not understanding this the right way.

I'm cleaning up some epubs and have noticed that some of them have anchor tags with a class and an id but without any hyperlink. Some epubs have several hundred in between the text.

So I'm using this regex to find anchor links with nothing inside them



The problem is that it also finds these tags with spans and even text inside.

I would like to be able to restrict the findings to only this situation.

Many thanks!
Your REGEX is fine as Doitsu said. It is also overly broad (second term) ;)
which is why it is matching </span></a>

if your id has an ending numbers use that to narrow the scope:(.+?\d+)"></a>
theducks is offline   Reply With Quote