I'm wrapping all urls with <a>
tag, but because I develop app style website, I need to replace all internal urls with a specific attribute.
So this:
href="http://domain.com/page/details"
should become
data-bind="page: '/page/details'"
the problem is, that it is not enough to just replace beginning because link itself should be wrapped in quotes for later javascript processing. Also I would like to cover situations like www.domain.com
with domain.com
UPDATE
It's as simple as it can get. I'm not asking for a url detection regex, I have all of that covered.
All I need is to change front part of href with url that matches current domain like I showed in example and then wrap rest of the url with single quotes.
I know how to simply change replace front part href="http://domain.com
into data-bind="page:
, but how can I wrap the rest remaining url /page/details
or in other words, all text up until first double quote, with a single quotes.