regex to remove particular string code example
Example 1: regex exclude character
[^a] #any character except 'a'
[^aA] #any character except 'a' or 'A'
[^a-z] #any character except a lower case character
[^.] #any character not a period
Example 2: deletes lines including regex match
Use d option at the end of sed replace definition for deleting line of matches.
sed -i "" "s/matching_pattern/d" file.txt