Ok i got this regex:
^[\w\s]+=["']\w+['"]
Now the regex will match:
a href=’google’
a href=”google”
and also
a href=’google”
How can i enforce regex to match its quote?
If first quote is single quote, how can i make the last quote also a single quote not a double quote
Read about backreferences.
Note that you want to put a
?after the second+or else it will be greedy. However, in general this is not the right way to parse HTML. Use Beautiful Soup.