regex matching links without <a> tag
(http([s]?):\/\/?)(([a-zA-Z0-9]+(\.?))+)([a-zA-Z0-9]+((\.[a-zA-Z]{2,5}){1,2})((\/[a-zA-Z0-9\?&=_\-\~:/?#[\]@!\$&'()\*\+,;]*)*)((\.[a-zA-Z]{2,5}){0,2})) This is my regex which is working well for matching the links in the string. But I don't want it to select every link. If a link has "> before it, or </a> after it, that link shouldn't be mathced. How can it be done? These should be matched: adasdas http://www.stackoverflow.com asdasas adasdasahttp://www.stackoverflow.com/something asdas These should NOT be matched: adasdas<a href="somelink"> http://www.stackoverflow.com </a>asdasas adasdasa<a