So I have a string X1X2X3\\\\
. I only want to capture the AlphaNumerics values. My regex is ([A-z0-9]*).*
. But it will return X1X2X3\\
. My code looks like this:
Pattern pattern = Pattern.compile("([A-z0-9]*).*");
Matcher matcher = pattern.matcher(str);
matcher.matches();
return matcher.group(1);
Would like to find regex Answer. Not String.replaceAll() or replace() :)