Help with Regex statement in Ruby
- by user336777
I have a string called 'raw'. I am trying to parse it in ruby in the following way:
raw = "HbA1C ranging 8.0—10.0%"
raw.scan /\d*.?\d+[ ](-+|\342\200\224)[ ]\d*.?\d+/
The output from the above is []. I think it should be: ["8.0—10.0"].
Does anyone have any insight into what is wrong with the above regex statement?
Note: \342\200\224 is equal to '—'.
The piece that is not working is:
(-+|\342\200\224)
I think it should be equivalent to saying, match on 1 or more '-' OR match on the string \342\200\224.
Any help would be greatly appreciated it!