how extract numbers along sign?
strings can these -1+110
, +20-123
, +23-432-543
i using simple regular expression
event_book_value = re.findall('\d+', event_book_value)
it returns numbers not return along signs.
add optional sign in front of number regex:
[+-]?\d+
[+-]
- character set matches single+
or-
?
- makes previous match 1 or 0 times\d+
- 1 or more digits
Comments
Post a Comment