ruby regex links not already in anchor tag

Posted by dorelal on Stack Overflow See other posts from Stack Overflow or by dorelal
Published on 2010-05-14T10:06:54Z Indexed on 2010/05/14 12:44 UTC
Read the original article Hit count: 148

Filed under:
|

I am using ruby 1.8.7. I am not using rails.

How do I find all the links which are not already in anchor tag.

s = %Q{ <a href='www.a.com'><b>www.a.com</b></a> www.b.com <div>www.c.com</div> }

The output of above string should be

www.b.com
www.c.com

I know "b" tag before www.a.com complicates the case but that's what I have to work with.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about regex