I am trying to isolate specific format groups within strings and convert them through JS or jQuery and regex, strings like these
#aba #abc #33-25
#02-20 #abe #abf
#abg #abe #00-50 #aba
#aja #255-45
to these
33.25€
2.20€
0.50€
255.45€
.
1. In regex level, my workaround so far for isolating #xx.xx groups within strings is
s = "#aba #abc #33-25"
s.match( /(#[W\d-]+)/ ) //["#33-25", "#33-25"]
It recognize the #33-25 substring but outputs it 2 times in an array which is obviously insufficient.
.
2. Also how it will work (JS or jQuery) to (solved by @Kosh's answer)
- remove # symbols
- replace hyphen symbol (-) to dot symbol (.)
- when #01-xx or #0-xx to convert to 1.xx or 0.xx (where x is obviously decimal numbers, always 2)