I need to generate a regExr for the below String pattern.
A:B:C:D
where A should contain only Strings and B can contain both String and a digits and C should be a String and D should only be the digits.
I created RegExr myself and its working.
[a-zA-Z]+(:)+[a-zA-Z1-9]+(:)+[a-zA-Z]+(:)+[1-9]+
But is there a better regExr for the pattern I want something bit shorter than mine? Or mine is ok?
I am using Java8.
(:)+means one-or-more colons, right? Seems you want exactly one colon, and you don't need to capture it. Also, a0is a digit too, you know. So this is what you need:[a-zA-Z]+:[a-zA-Z0-9]+:[a-zA-Z]+:[0-9]+(?i)[a-z]+:[a-z0-9]+:[a-z]+:[0-9]+