Reputation: 33
I need to replace some html file names in my html file with anchor tags, such that:
abc.html
file.html
becomes:
<a href="abc.html">abc.html </a>
<a href="file.html">file.html </a>
I have though of the following regex in find
: [a-z-0-9]+\.html
and it seems to work, but I don't know what to add in replace
. I have tried some answers from here , but they did not work. Can you please help?
Upvotes: 0
Views: 140
Reputation: 56
You need to use capturing groups, that then you can refer back to in the replace box..
Capture groups are created adding parenthesis to find
: ([a-z-0-9]+\.html)
Then replace
would be: <a href="$1">$1 </a>
$1
means the first capture group.
Upvotes: 1