Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In less, can you search using / for a pattern that contains a carriage return and newline? I know your pattern can end with a line using $ (from How do I include newlines in a search in less?), but I need the pattern to match text that spans multiple lines.

I tried \n, but that only searches for the n character.

share|improve this question
    
Have you tried \n+ for 1 or more newlines? –  Brock Hensley Jan 17 at 1:45
add comment

1 Answer 1

Not sure how to do it in less, but you can accomplish the same in vim.

http://vim.wikia.com/wiki/Search_across_multiple_lines

/PATTERN1\\_.\\{-}PATTERN2

The atom \\_. finds any character including end-of-line. The multi \\{-} matches as few as possible.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.