On Mi, 05 Jul 2017, Igor Forca wrote:

> Hi,
> I have a log file with several text OK and error messages.
> 
> OK message is always: AAA000A
> 
> Error message starts with AAA, then three numbers (but not three zeros) and 
> letter A.
> Error sample: AAA001A
> 
> From the Vim Regular Expression web site:
> http://vimregex.com/#metacharacters
> I can see:
> \d digit
> \D non-digit
> 
> To find OK and error message in vim:
> /AAA\d\d\d\D

This will find okay or error messages.

> but how to get only error messages.
> 
> Something like:
> - use: /AAA\d\d\d\D
> - except: /AAA000A

Something like this should work:
A\{3}\%(\([^0]\d\{2}\)\|\(\d[^0]\d\)\|\(\d\{2}[^0]\)\)A
which matches 3 As, followed by either:
- a non-zero followed by 2 digits followed by another A or 
- a digit followed by a non-zero followed by another digit and A or
- 2 digits followed by a non-zero followed by another A


Best,
Christian
-- 
Warum überquerte das Huhn die Straße?
Kindergärtnerin:
  Um auf die andere Straßenseite zu kommen.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to