Extract double nomber from string


#1

Hi,

i had to extract a number from a string.
for exemple if i had “my father had 1.5 euro” i extract 1.5


#2

use regex with this patttern:
(-?[0-9]+(?:[,.][0-9]+)?)


#3

can you explaine more or dro a code,i think we need regex


#4

sure…
https://regexr.com/3hls9 this link will explain the above pattern step by step
and this link: https://www.regular-expressions.info/ will help you understand the regex better.
hope this is helpful