I am using textmate to edit a file. I would like to remove all the lines not containing a word. Here is an example.
apple ipad hp touch pad samsung galaxy tab motorola xoom
How can i remove all the line not containing the word "pad", and get this result, using Regular Expression??
apple ipad hp touch pad
Thanks all.
If you are having a string with special characters and want's to remove/replace them then you can use regex for that. Use this code: Regex.
When you want to search and replace specific patterns of text, use regular expressions. They can help you in pattern matching, parsing, filtering of results, and so on. Once you learn the regex syntax, you can use it for almost any language. Press Ctrl+R to open the search and replace pane.
Replace ^(?!.*pad.*).+$
with empty string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With