A pattern matching an expression that doesn't end with specific sequence

Posted by patryk on Stack Overflow See other posts from Stack Overflow or by patryk
Published on 2012-11-11T21:52:39Z Indexed on 2012/11/11 23:00 UTC
Read the original article Hit count: 790

I need a regex pattern which matches such strings that DO NOT end with such a sequence: \.[A-z0-9]{2,} by which I mean the examined string must not have at its end a sequence of a dot and then two or more alphanumeric characters. For example, a string /home/patryk/www and also /home/patryk/www/ should match desired pattern and /home/patryk/images/DSC002.jpg should not. I suppose this has something to do with lookarounds (look aheads) but still I have no idea how to make it. Any help appreciated.

© Stack Overflow or respective owner

Related posts about regex

Related posts about regex-negation