简体   繁体   中英

In Java, how do i search for this certain regex?

I want a function to search a string to see if it contains $[0-9] or $[af,AF]

So like, if it contains $a or even $e it'll turn true.

The regex is /\\$[A-Fa-f0-9]/ and you might use it like so:

Pattern.matches("\$[A-Fa-f0-9]", yourString);

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM