python - Regular expression to match $price -
i in need of regular look matches cost like: $200, $143.
so requirements are, there should spaces before , after cost like: ... $130 ...
and there should dollar sign "$" before digits.
help please.
p.s. using python
something like:
\s\$(\d+)\s
edit:
as avinash raj noted in answer, including spaces in pattern prevent match of sequences of prices. improve way 1 shows lookarounds:
(?<=\s\$)(\d+)(?=\s)
here's demo.
python regex
No comments:
Post a Comment