I am trying to write a regular expression that will accept the following:
S # # # # # # # # # Where # can be an integer of any size (in fact, decimal or beforehand decimal) I do not accept anything except If so, then there is something like this:
Like #. Will not be accepted because the first one of A is # # X will not be accepted because after decimal is x will always have to start either one or a f, then a Number, a period, and second number all those parts are required and the numbers can be integer in any size and any number.
This regular expression:
/ ^ [sf] \ d + \. \ D + $ / Explanation -
^ is the one that matches the beginning of the string Have an account. -
[sf] another and it means s or f . -
\ d means a digit. -
+ means one or more. -
. matches a literal point. -
$ is an anchor that matches the end of the string.
Comments
Post a Comment