When i test the below code on Linux ideally the regex check should fail and exit 1 should be executed but somehow it goes through.
build_params="plans-psgdevops_4011.json"
if ! [[ $build_params =~ ^plans-(sstf-|deploy-|release-|uitest-|other-){1,5}?([a-z0-9~_]+).json ]];
then
echo "Filename: $build_params does not follow the correct naming convention."
exit 1
fi
echo "Match went thru " $build_params
The same thing tested on regex101.com matches expectations.[image bleow]
How can we make it work on Linux ??