Reputation: 37
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.
Upvotes: 1
Views: 228
Reputation: 379
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")
Upvotes: 0
Reputation: 31147
#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")
Upvotes: 2