Punctuation Regex in Java

前端 未结 2 1436
花落未央
花落未央 2020-11-29 09:50

First, i\'m read the documentation as follow

http://download.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html

And i want find any punctuation c

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 10:11

    You're matching two characters, not one. Using a (negative) lookahead should solve the task:

    (?![@',&])\\p{Punct}
    

提交回复
热议问题