In java, which regular expression can be used to replace these, for example:
before: aaabbb after: ab
before: 14442345 after: 142345
thanks!
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.
In perl
Does the trick, I assume if java has perl compatible regexps it should work too.
Edit: Here is what it means
Edit: As others have pointed out, the syntax in Java would become
remember to escape the \1