I'm trying to build a Java regular expression to match ".jar!
"
The catch is that I don't want the matcher to consume the exclamation mark. I tried using Pattern.compile("\\.jar(?=!)")
but that failed. As did escaping the exclamation mark.
Can anyone get this to work or is this a JDK bug?
UPDATE: I feel like an idiot, Pattern.compile("\\.jar(?=!)")
does work. I was using Matcher.matches() instead of Matcher.find().