I have a long text file and I want to save all the lines that are similar to the following:
Customer Code: BER17O
How can I use REGEX to delete all the data except these lines?
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.
Use
multilineoption with thisregex^(?!Customer Code: \w+$).*$OR[if you want to be specific]
^(?!Customer Code: BER17O$).*$(?!)is a negative lookahead which doesnt match the line if the line starts withCustomer Code:followed by the word!