I have a file that contains something like this:
VERSION = 1.1.1
version = 1.1.1
VERSION = "1.1.1"
VERSION = '1.1.1"
etc
I am trying to grep for the version number, using this:
grep -E "(VERSION|version|Version)[^0-9]*([0-9]+\.[0-9,A-Z,a-z]+\.[0-9,a-z,A-Z]+)" -oP setup.py
This complains that 'conflicting matchers specified'. Presumably because there are two capturing groups. I have tried to make the first group non-capturing: (?:VERSION|version|Version)
, but this gives the same error. The version with the non-capturing group does work when tested on regex101 (https://regex101.com/r/21Pkp2/1), so I'm not sure why it doesn't work in grep.
E
(ERE) and-P
(perl mode) togethergrep -ioP "version\D*\K(\d+\.[\d,A-Z,a-z]+\.[\d,a-z,A-Z]+)" file