Can someone help me with the following Java regex expression? I've done some research but I'm having a hard time putting everything together.
The regex:
"^-?\\d+$"
My understandning of what each symbol does:
"
= matches the beginning of the line-
= indicates a range?
= does not occur or occurs once\\d
= matches the digits+
= matches one or more of the previous thing.$
= matches end of the line
Is the regex saying it only want matches that start or end with digits? But where do -
and ?
come in?