How to escape special characters (eg $
or ?
) in CoreNLP TokenRegex pattern (eg /$[0-9,]+/
where $
refer to the currency symbol). For example, in java the pattern would be \\\\$[0-9,]+
.
Is there a fuction similar to Pattern.quote()
in CoreNLP TokenRegex?
For special characters inside of regular expressions -- as in your example of /$[0-9,]+/
-- this is the same escape character as Javan's Pattern. That is, '\\'. So in your case, /\\$[0-9,]+/
.
For TokensRegex special characters, you can always quote them. For example: foo "[" citation needed "]"
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.