Google sheets regex expression

Viewed 50

Anyone can help me with this regular expression? I need to extract the price from a list of items.

<span class="woocommerce-Price-amount amount"><bdi>22,21<span class="woocommerce-Price-currencySymbol">&euro;</span></bdi></span>.

I found this, but I am not extracting the ",".

=REGEXREPLACE(H8;"\D+"; "")*1
2 Answers

try:

=REGEXEXTRACT(A1, "\d+,\d+")

enter image description here

You can use

=REGEXEXTRACT(H8;"(\d[\d,]*)<span\s+class="woocommerce-Price-currencySymbol">&euro;")

See the regex demo.

Details

  • (\d[\d,]*) - Capturing group 1 (the group value is the return value of the REGEXEXTRACT function): a digit and then any zero or more digits or commas
  • <span\s+class="woocommerce-Price-currencySymbol">&euro; - a literal string with any one or more whitespaces between the tag name and the class attribute.
Related