Regular expression to match any line that contains a string
February 11, 2013
BBedit | Web Building

I use BBEdit to clean up text files generated by various highlighting and note-taking apps. One application that I particularly like, Skim, exports a list of all the highlights you've made in a PDF, each prefaced with a line like:

* Highlight, page 74

I wanted to get rid of those line indicators, so I could incorporate those highlights into some sort of meaningful summary. Since each line has a different page number, I use a regular expression to do a grep search. The syntax that works is:


^.*Highlight, page.*$


What does each character mean?
  • ^ (a caret) indicates a match with the starting position of the string.
  • $ (a dollar sign) indicates the end of the string.
  • .* (dot followed by asterisk) matches any characters in between the beginning of the line (^) and the search term (Highlight, page)

Ads by Google

Posted by ellen at February 11, 2013 02:05 PM


Ads by Google

 RSS   |   Contact Me

Ads by Google

Ads by Google