Let's say i'm given a string
"<span class='price'>6.86</span>"
How can I use regexp-match in order to show "6.86" without knowing the size of the number, or the number used.
So, it could be "x.xx", "xx.xx", "xxx.xx", and so on.
Let's say i'm given a string
"<span class='price'>6.86</span>"
How can I use regexp-match in order to show "6.86" without knowing the size of the number, or the number used.
So, it could be "x.xx", "xx.xx", "xxx.xx", and so on.
#lang racket
(define elm "<span class='price'>6.86</span>")
(regexp-match "<span class='price'>([0-9.]*)</span>" elm)
Ouput:
'("<span class='price'>6.86</span>" "6.86")
my version:
(regexp-match #rx"<span class='price'>([0-9]*\\.*[0-9]*)</span>"
"<span class='price'>6.86</span>")
'("<span class='price'>6.86</span>" "6.86")