regex - How to match lines not ending (-1)\r\n -
i'm trying match first 5 lines, , last line, in sample:
-- 2012-09-20 rep +6 = 184 1 12532070 (2) 2 12531806 (5) 2 12531806 (5) -- 2012-09-21 rep +12 = 196 3 125xxxxx (-1) 3 125xxxxx (-1) 16 12557052 (2)
leaving following unmatched:
3 125xxxxx (-1) 3 125xxxxx (-1)
i've tried following regular expressions:
^.*[^(-1)\r\n].* ^.*[^(-1)].*\r\n ^.*[^\(-1\)\r\n].* ^.*[^\(\-1\)\r\n].* ^.*[?!\(-1)\r\n].* ^(!?.*-1.*\r\n)
but none of them want (mostly matching all lines).
my regex skills not brilliant - can point me in right direction?
you can use negative lookahead
^(?!.*\(-1\)$).*$\r\n
Comments
Post a Comment