I would like to match the following
- com.my.company. ModuleA .MyClassName
- com.my.company. moduleB .MyClassName
- com.my.company. anythingElse .MyClassName
but not next
- com.my.company. .MyClassName core
My current simple regex pattern:
Pattern PATTERN_MODULE_NAME = Pattern.compile("com\\.my\\.company\\.(.*?)\\..*") Matcher matcher = PATTERN_MODULE_NAME.matcher(className); if (matcher.matches()) {
So basically, how can I match everything else, but not a specific string, which is the core string in my case.
Share your ideas on how to achieve this in Java?
Thanks!
source share