0

What '?' Does in regex?

I have a regular expression : re.search(r"^[+-]?[0-9]*\.[0-9]*

quot;,txt). I don't understand the use of '?'.

8th May 2020, 4:46 AM
Sagar Singh
Sagar Singh - avatar
6 Answers
+ 4
rodwynnejones is right, I corrected my answer.
8th May 2020, 2:19 PM
CalviŐ˛
CalviŐ˛ - avatar
+ 3
I'm sure the "?" means zero or one occurrence.
8th May 2020, 11:46 AM
rodwynnejones
rodwynnejones - avatar
+ 2
edited ? zero or one occurance only of preceding letter [+-]? matches + or - or ''
8th May 2020, 6:39 AM
CalviŐ˛
CalviŐ˛ - avatar