Java – regular expression patterns match all uppercase letters after colons
•
Java
I need a pattern that matches words like apple: or pear:
[A-Z] [:] will match R: but not the whole word, so it will give me a false when I try to match
Can I help you?
Solution
Just add "quantifiers":
/[A-Z]+:/
Note that a single character does not require a character class
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码