Created
September 30, 2024 05:37
-
-
Save jamesasu/38409f2b636f764c17387bd4d41fe26d to your computer and use it in GitHub Desktop.
java-regex-negative-lookbehind-lookahead.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pattern newProjectPattern = Pattern.compile("(?<=before)(Stuff to actually find)(?=after)"); | |
Matcher newProjectMatcher = newProjectPattern.matcher(str); | |
if (newProjectMatcher.find()) { | |
return newProjectMatcher.group(1).trim(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment