I need a pattern (java regexp) which matches if there is a comma after key or key is at the end of line. i.e it should match both of followings:
1. xxxkey,yyy
2. xxxkey
Ive tried [\\,$] pattern but it doesn’t work.
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.
$inside a character class loses its special meaning. Use the following instead:If you don’t need to know whether there was a comma, you can use a non-capturing group instead: