How can I match a pattern in regex that can contain anything (letters,numbers,…) but matches only if it contains an underscore?
Basically I want to match bob_hello but not bobhello.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This seems pretty much like a homework question, so I’m not going to just give you the answer.
But, what you need to do is this:
Write a three part regular expression:
There are other ways, of course – but this will work.