Skip to content

Add title attribute to link

Shell
5 mo. ago

Regex pattern to add link text to title attribute.

regex
url
add-title-attribute-to-link-pattern.sh
# Find all <a> tags and capture href and text into groups 1, 2
# $1 is ([^"]+) matches any character except "
# $2 is ([^<]+) matches any character except <
<a\s+href="([^"]+)"[^>]*>([^<]+)</a>