G
Gene Wirchenko
Dear JavaScripters:
I have not found quite the detail that I need for regexes. If
you have a URL to a good site, please post it. In particular, how do
I group subexpressions?
I wish to parse a string to see if it is a valid fixed-decimal
value.
I start with
/^
How do I check a set of characters optionally? I want to check
for a sign character. The string might start with "+" or "-", but if
it starts with neither, that is fine. Do I leave an empty choice in a
parens set? Is it then
([+-]|)
or
[+-]?
?
Then come optional digits:
\d*
Then another complex maybe for the decimal point and digits
following:
(\.\d*|)
or
(\.\d*)?
?
And the end
$/
The regex should accept:
123
+123
-123
123.
+123.
-123.
123.45
+123.45
-123.45
It will also accept
I have not found quite the detail that I need for regexes. If
you have a URL to a good site, please post it. In particular, how do
I group subexpressions?
I wish to parse a string to see if it is a valid fixed-decimal
value.
I start with
/^
How do I check a set of characters optionally? I want to check
for a sign character. The string might start with "+" or "-", but if
it starts with neither, that is fine. Do I leave an empty choice in a
parens set? Is it then
([+-]|)
or
[+-]?
?
Then come optional digits:
\d*
Then another complex maybe for the decimal point and digits
following:
(\.\d*|)
or
(\.\d*)?
?
And the end
$/
The regex should accept:
123
+123
-123
123.
+123.
-123.
123.45
+123.45
-123.45
It will also accept