Homebrew/homebrew — pull request #35226 by dakcarto (2014-12-24 02:21:54+00:00)
Title: Add regex support to conflicts_with

In the proposed `homebrew/geospatial` tap, it would be advantageous to support limited versioning of formulae (as I have done in the [OSGeo4Mac tap](https://github.com/OSGeo/homebrew-osgeo4mac/tree/master/Formula)). Generally, this would be only the two latest versions, and only if needed, e.g. `grass-64` and `grass-70`.

Limited versioning like this has not been a problem except when formulae are deprecated or can not be simultaneously linked, though the separate versions can usually coexist if all but one are keg-only. Adding regex support to `conflicts_with` solves these issues, thereby skipping the need to have multiple listings of all versioned formulae (past and present) or some funky custom `Requirement`.

Example:

```ruby
conflicts_with /qgis(-\d\d)?/, :because => "only one QGIS can be linked"
# matches `qgis`, `qgis-22`, `qgis-24`, ...
```

After migrating all `qgis` formulae to the proposed `homebrew/geospatial` tap, this would also ensure any previously installed formulae (regardless of naming convention) would be found and checked as a conflict.