I have an issue with a regular expression. I have an application that has several textfields. But in one of these fields there is a string which contains a number in the following format.
The String can have one of the upper formats.
KV can be there or not. It can be lower or uppercase mixed. Then KV is followed by a number that can be between 5 and 8 digits long.
between the numbers can be dots and dashes. Before and after the string there can be spaces.
I can't get a regular expression to select all the possible variations.
So far I have:
^(K|k|\d)(V|v|\d)(\d|\.|\/){1,11}$
It captures each string of upper Block but fails to catches string that start with spaces or end with spaces
Code:
2561546
125.456/7
K2561546
KV2561546
k256.154/6
kv256.154/6
kV256.154/6
Kv256.154/6
KV2.123.132/6
2561546
125.456/7
K2561546
KV2561546
k256.154/6
kv256.154/6
kV256.154/6
Kv256.154/6
KV2.123.132/6
K2561546
The String can have one of the upper formats.
KV can be there or not. It can be lower or uppercase mixed. Then KV is followed by a number that can be between 5 and 8 digits long.
between the numbers can be dots and dashes. Before and after the string there can be spaces.
I can't get a regular expression to select all the possible variations.
So far I have:
^(K|k|\d)(V|v|\d)(\d|\.|\/){1,11}$
It captures each string of upper Block but fails to catches string that start with spaces or end with spaces