I once argued that it `could not be so hard to write a regexp that validates Debian package versions`. Ohboy. Let&#x27;s just say that in the end it became a point of pride to come up with something.<p>Debian package version numbers have leading and trailing optional parts and if they are specified, then the characters used as separator of these parts are allowed as part of the version number.<p>The resulting regexp ended up being essentially four different regexp expressions with four leading conditions utilizing look-ahead and look-behind matching to select which inner regexp to use. It was sufficiently beyond actually regular, even if supported by modern RE tools.<p>And this is a common pattern in my experience. If you frequently need look-ahead or look-behind, you are often past something you should reasonably disassemble using regexp and should instead start defining a grammar and parse the input stream against it.