regex no character

Posted by iamnotmad on Stack Overflow See other posts from Stack Overflow or by iamnotmad
Published on 2010-06-01T21:46:13Z Indexed on 2010/06/01 21:53 UTC
Read the original article Hit count: 128

Filed under:

In this text:

warning here
there are several types of warnings
in this string warning.gif
at the end warning
end of line warning

I want to match every warning except warning.gif.

I cannot seem to get it to include the last one that has no character (control or otherwise) after it.

using warnings?[^\.] gets what I want except for the last warning (on the last line). I think because there is no character at all after. How can I get it to include that one?

© Stack Overflow or respective owner

Related posts about regex