开发者

java regular expression [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its 开发者_如何学Gocurrent form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

How do I match a file name that does not end with a hyphen, using Java?


If you really, really need the regexp, this should do: .+[^-] (at least one character (any) followed by anything BUT hypen). It can be as complicated as you want to check for possible border cases, if needed.


Why would you need a regex for that? Especially in Java. You can just check whether a hyphen is the last character of the filename.


Try (any character at least one time plus the last one any character except '-'):

.+[^-]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜