Please fence your code in three backticks (```) on separate lines to make it easier to read.
You need to add *? after each dot, because a dot on its own only matches one character. The asterisk specifies to match as many characters as possible and the question mark then changes this to match as few characters as possible.
Examples
I’ve added parenthesis to the matches to indicate the content of the group. They are not part of the actual text that is matched!
Regex: text="(.)"
Matches:
text="(1)"
doesn’t match:
text=""
text="foo bar"
text="foo" data="bar"
Regex: text="(.*)"
Matches:
text="()"
text="(1)"
text="(foo bar)"
text="(foo" data="bar)"
Regex: text="(.*?)"
Matches:
text="()"
text="(1)"
text="(foo bar)"
text="(foo)" data="bar" (notice the different closing parenthesis compared to the previous regex)