Take the 2-minute tour ×

I have the following two lines:

test.tex|42 error| Undefined control sequence
test.tex|43 error| Undefined control sequenceFAILURE

I want a regex that matches "Undefined control sequence" in both lines (thus ignoring the FAILURE part in the second line). I tried with

/^|\d\+ error|\s\zs.*

but that obviously highlights FAILURE too. I suppose I must use a negative lookahead but I'm using it wrong since the following doesn't work

/^|\d\+ error|\s\zs.*\(FAILURE\)\@!

EDIT: The "Undefined control sequence" is just a type of error. The generic structure of the lines is

 file|number error| Error message

I want a generic regex that matches only the error message that sometimes ends as

Error messsageFAILURE

I want to ignore the "FAILURE" part and just get the "Error message"

share|improve this question
why /Undefined control sequence won't work? –  Kent Sep 19 '13 at 12:56

2 Answers 2

up vote 1 down vote accepted

for your question, /Undefined control sequence will work exactly what you wanted.

If you want to have some dynamic matching, you could try:

share|improve this answer
I edited my question to clarify what I need. Your second regex kind of works but it also matches "error | " which I want to ignore. –  petobens Sep 19 '13 at 13:19
@petobens there was a small mistake, I fixed it now. sorry. –  Kent Sep 19 '13 at 13:27
Thanks now it works –  petobens Sep 19 '13 at 13:42

The pattern /Undefined control sequence will match both lines, while the pattern /Undefined control sequence\> will only match the first line since \> matches the end of a word.

share|improve this answer
Sorry, I misread the question. I have expanded my previous answer. –  Marco Baldelli Sep 19 '13 at 13:14

Your Answer


