Reputation: 2844
I am trying to get a price and the plus or minus from a string using jquery.
I'm pretty sure regex is the way to go, but I just can't seen to get it right.
input:
Bla bla bla bla (- € 0.25)
should output:
direction = -
amount = 0.25
What regexes should I use?
Upvotes: 0
Views: 1551
Reputation: 15813
"[^€]*€[ ]*\([.[:digit:]]*\).*" -> "\1"
This is POSIX. You can use it so:
sed "s|[^€]*.[ ]*\([.[:digit:]]*\).*|\1|"
Upvotes: 1