Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Regex : Underscore

807580Aug 7 2010 — edited Aug 7 2010
Hello everybody.
I am learning Java Regular expression. But I got a problem, I am not able to understand the use of underscore.
I have an expression say :
Pattern.compile("[a-zA-Z]+[_1-9a-zA-Z]*")
This means [a-zA-Z] one or more times, but what does [_1-9a-zA-Z] means? The last '*' implies the occurrence of [_1-9a-zA-Z] will be zero or more time. What is the use of underscore here? Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2010
Added on Aug 7 2010
3 comments
1,213 views