grep -E (not working) vs grep -Po (working)

49 Views Asked by At

I have shell script for ci cd pipeline. I am executing it in intellij ide terminal.

latestVersionAvailable=$(curl -s $artifactoryPath/maven-metadata.xml | grep -Po '(?<=<version>)'$VERSION'.*?(?=</version>)' | sort -V | tail -1)
echo " latest $latestVersionAvailable"

when I use above it inside shell script, it is working with -Po , but when I use -E it is not giving me any results back why?

1

There are 1 best solutions below

0
choroba On

-E is for extended regular expressions. Unlike PCRE (Perl compatible regular expressions, -P), ERE don't support look ahead assertions.