html RegEx: Matching a number followed by a space within a link

Viewed 25

I want to match this link with a regex to scrape the value (e.g. 8.026,00) from a website. Since the link is unique, I take it as the identifier for the value (which changes frequently).

<a href="randomlink">8.026,00 </a>

When hardcoding the value it matches:

(<a href="randomlink">)(8.026,00 )(<\/a>) 

When trying to make it variable it fails:

(<a href="randomlink">)(^[+-]?(?:\d+|\d{1,3}(?:.\d{3})*)(?:\,\d*)?$ )(<\/a>)

The variable part does work on the number alone. However, it also fails when having a space behind the number alone. Inserting afterwards \s* does not work. As it does not work within the whole expression.

What do I have to do to make it work?

Thanks a lot in advance. As you might guess, I am fairly new to regex...

0 Answers
Related