How to remove lines that do NOT end with a particular sequence with regex -


I want to use regex to find all the words in a dictionary file that ends with a special character sequence . I currently have the following regex

 . * Personus $   

, which matches all the entries in my dictionary with my personal information.

But now I really want to reverse this regesis to match all lines ending with my palves, so I can change them with empty string and end with my presentation I can end up with a good list of dictionary entries that occur. I tried to reject the expansion portion using the following regex:

 . * [^ (Persvance)] $   

The resulting list contains all the basic entries that end with my entries, but there are also some entries that do not end with my divine .

Note: There are a lot of similar questions on the stack overflow, but I was not able to find any that was completely my special case. Most similar questions are either to focus on extracting those lines that do not start with a particular sequence, or focus on removing those rows that have a special character (unlike the sequence of characters ).

Any help would be greatly appreciated!

Use a negative form to match all the lines except the one which Persvanceen ends with

  ^ (?!!! * Persvance $). * $   



Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -