Regex to match \ a574322 in Java
My long line looks like this: \ c53 \ e59 \ c9 \ e28 \ c20140326 \ a4095 \ c8 \ c15 \ a546 \ c11, and I need to find expressions starting with \ a and followed by numbers. For example: \ a574322 And I have no idea how to build it. I cannot use:
Pattern p = Pattern.compile("\\a\\d*");
because \ a is a special character in regex. When I try to group it like this:
Pattern p = Pattern.compile("(\\)(a)(\\d)*");
I am getting an unlocked group error even if there is an even number of parentheses. Can you help me?
Thank you very much for your solution.
+3
source to share
4 answers