Javascript Regex validation
-
Hello, I am using regex to validate some patterns in javascript My pattern is
[VF][0-9]
And required output is V1-V9 , F1-F9 in any order (eg:V1,V3,V2,F1,F5,F3) OR (eg: F1,F5,F3,V1,V3,V2) But it is not working can any one help me? Thanks and regards.
-
Hello, I am using regex to validate some patterns in javascript My pattern is
[VF][0-9]
And required output is V1-V9 , F1-F9 in any order (eg:V1,V3,V2,F1,F5,F3) OR (eg: F1,F5,F3,V1,V3,V2) But it is not working can any one help me? Thanks and regards.
You question is not clear. The regex provided will check if the string has an V or F (case sensitive) at the first position and then a digit (0-9). But the part of the 'required output' is confusing! What the input, what the output, what have you expected?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
You question is not clear. The regex provided will check if the string has an V or F (case sensitive) at the first position and then a digit (0-9). But the part of the 'required output' is confusing! What the input, what the output, what have you expected?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
Hello, My input is something like V1V2-V3-S-V4-F1 And I need to validate the given value contain any of V1 to V9 or F1 to F9 and S. eg: if user input V20V30-V12-S10-V20-F10 I have to show a error because only 1-9 is allowed. eg2: if user input R1R2-R3-S-R5-T6 I have to show a error because only V,S,F allowed And it is not mandatory to enter V/F but S is mandatory. I think it is clear now.
-
Hello, My input is something like V1V2-V3-S-V4-F1 And I need to validate the given value contain any of V1 to V9 or F1 to F9 and S. eg: if user input V20V30-V12-S10-V20-F10 I have to show a error because only 1-9 is allowed. eg2: if user input R1R2-R3-S-R5-T6 I have to show a error because only V,S,F allowed And it is not mandatory to enter V/F but S is mandatory. I think it is clear now.
You may try this regex - http://www.regexper.com/#((%5BFV%5D%5B0-9%5D)%2B%5B%5E%5Cd%5D)[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
Hello, My input is something like V1V2-V3-S-V4-F1 And I need to validate the given value contain any of V1 to V9 or F1 to F9 and S. eg: if user input V20V30-V12-S10-V20-F10 I have to show a error because only 1-9 is allowed. eg2: if user input R1R2-R3-S-R5-T6 I have to show a error because only V,S,F allowed And it is not mandatory to enter V/F but S is mandatory. I think it is clear now.
You need the pattern "[VF][1-9]-?$" Because V20 matchs [VF][1-9] as V2 Hope this will help you.