Do not parse html files with regular expression. If you insist, you can use the following regular expression and get the text inside the anchor tags from group 1 index.
<a\s[^<>]*>([^<>]*)<\/a>
Demo
Explanation:
<a '<a'
\s whitespace (\n, \r, \t, \f, and " ")
[^<>]* any character except: '<', '>' (0 or more
times)
> '>'
( group and capture to \1:
[^<>]* any character except: '<', '>' (0 or
more times)
) end of \1
< '<'
\/ '/'
a> 'a>'
source
share