I would like to match the following
Perhaps a regex is not the clearest way to write this.
if (className.startsWith("com.my.company.")
&& !className.startsWith("com.my.company.core.")) {
}
This is fair clear what it does, and you might find it is faster. ;)
You can use the following regex:
^com\\.my\\.company\\.(?!core).+?\\.MyClassName$