如果不使用捕获组,则可以使用超前(
(?= ... )业务)。
javas?[^A-Z]*(?=.[A-Z])应该捕获您想要的一切。这里是细分的:
java //Literal word "java"s? //Match for an optional space character. (can change to s* if there can be multiple)[^A-Z]* //Any number of non-capital-letter characters(?=.[A-Z]) //Look ahead for (but don't add to selection) a literal period and a capital letter.



