Assuming I have many strings that are like this:
<a id="1.1">
<a id="1.1.1">
<a id="1.1.2">
<a id="1.1.3">
<a id="1.2">
<a id="1.2.1">
I want to make a regular expression that catches only the ones with “#.#”, so I am trying to match it such that it ends with a double quote, but I am getting no matches.
re.compile("[1-9].[1-9]\"")
The resulting output I expect is a list containing:
<a id="1.1">
<a id="1.2">
What am I doing wrong? (Please suggest if there is a better way to match than the method I am using.)
Put double quotes on both sides:
r'"\d\.\d"'.For example,