So I have a regular expression that will look into a string and match all of the relative anchor links, like: Leaderboard
It will not match where the href starts with HTTP or HTTPS.
Expression is:
<a.*?href="([^http]|[^https]).*?"[^<]
That part is good for now.
However, I cannot seem to figure out that after I get the match I want to replace just the href name with routerLink.
This:
<a href="/leaderboard">Leaderboard</a>
Becomes:
<a routerLink="/leaderboard">Leaderboard</a>
Note href is now routerLink.
There are 20+ matches so I can't simply do a replace with Leaderboard I need to keep the relative path the same. Literally the only thing in the matched string that gets replaced is href for routerLink and the value of that attribute stays as is.
This part is giving me issue!
Any ideas here?
Thanks