Replies: 3 comments
-
Can you show some example code? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sure :
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Well, after reading again the V doc and some test, I finded the good V regex :
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I try to define with a simple regex operation if some inputs numbers have a valid format. ( integer/decimal). The specificity of my test should use "period" character and not "comma" for the decimal part.
I work with this regular expression and the matches_string(string)bool function ( native regex module function ) :
([0-9]+[.]{1}[0-9]+)|([0-9]+[^.])
However, I have problems in some situations like :
2000 is invalid (first problem), 15.50 is valid( OK here ), .1500 is invalid (OK here ), 2000. is invalid ( OK here ), 20..00 is invalid ( OK here ), 20.3.50 is valid (second problem here ), 20.0.0. is valid ( third problem here ), 200da0 or 20 36 is valid ( fourth problem here ). etc.....
I went through the documentation : V regex module, and use some stuff like print of the regex execution code, but I admit to being in trouble with my test.
In javascript, with this regex :
^[0-9]+\.?[0-9]+$/gm
I get better results : test javascrip url
If someone have an idea and can explain at how resolve this issue with V regex. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions