/^[-+]?\d+\.\d+$/
Can someone please break this down for me?
Thanks!
What does this PERL expression mean?
that's called a "regular expression"
you may want to do some research on regular expressions to figure out what they mean, but i'll break this down for you:
/^[-+]?\d+\.\d+$/
the first "/" and last "/" are only there to enclose the regular expression:
^[-+]?\d+\.\d+$
the "^" means to check from the beginning and "$" means to check all the way to the end.
[-+]?
the ? means to match 1 or 0 of any of the characters enclosed in the square brackets [ ]...
\d+
this means to match any digit character, represented by \d, and the "+" means to match any digit 1 or more times.
\.
this means to match a period
\d+
same as the other
Reply:everything stays as aamina said except english description: the expression will be true if checked variable represents decimal number (preceding + or - sign is optional)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment