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
4 Respuestas
+ 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