I need a regular expression that takes as input alphanumeric followed by forward slash and then again alphanumeric. How do I write regular expression in Java for this?
Example for this is as follows:
adc9/fer4
I tried by using regular expression as follows:
String s = abc9/ferg5;
String pattern="^[a-zA-Z0-9_]+/[a-zA-z0-9_]*$";
if(s.matches(pattern))
{
return true;
}
But the problem it is accepting all the strings of form abc9/ without checking after forward slash.