I have
text text text [text text] \n
text text text [text text] \n
I want
text text text \n
text text text \n
What RE can I use?
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.
The following works regardless of whether the
\nis the end of line or a backslash and a letter ‘n’:The pattern looks for an open square bracket followed by any sequence of characters up to the last close square bracket and a following space (if there are several). You could refine the ‘
.*‘ into ‘[^]]*‘ to match anything that is not a close square bracket; this only deletes to the first close square bracket.