I am trying to highlight a set of lines, between the line containing ULS at the top of the line, to the line containing star in the bottom. I have tried many combination but I have failed. If someone could kindly guide me the correct regex for that selection. (Note: I am working in Windows).

I have unsuccessfully tried to use the following regex:


enter image description here

1 Answer 1


I'm a little unclear about precisely what you're trying to achieve, but this search finds the lines between ULS and the first line that follows that begins with a "*" character, and includes all the lines between those lines within a capture group:


Broken down:

  • /ULS: "ULS"
  • \p\+\n: Any number of printable characters, followed by a newline
  • \(: Start of capture group
  • \_p\{-}: Any number of printable characters, including newlines. \_p is a variant of \p that also matches newlines (the underscore can be used in other character classes in the same way: see :help 27.8 for details). \{-} is a non-greedy version of *
  • \): End of capture group
  • \n\*: A newline followed by a star.
  • Thank you Rich this is exactly what I was looking for. Additionally could you point me to some resource which could help me improve my understanding of regex. Apr 7, 2017 at 11:19
  • 1
    I'm not sure if I'd recommend it as the best tutorial, but most of what I know about regular expressions I learned from reading through :help regexp. :help usr_27 is a much more readable introduction, though.
    – Rich
    Apr 7, 2017 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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