I want to the match the string /word/test
. I tried \/word\/(.*)
on regex101 and that works perfectly. It puts test
in group1 and that's the part I want to extract.
But when I try this in Java I can't get it to work. This is my java:
Pattern p = Pattern.compile("\\/word\\/(.*)\\/");
But this comes out with no matches. I've been using freeformatter to test out the java regex but have been unable to get anything to match. I think the forward slash is throwing things off but I've tried so many different. I've looked at this thread and tried \\\\/
but that doesn't work either.