I would like to extract a substring by regex and output the matched group.
In below example string,the expected output is the string after "package:" and end with ".apk". below code works at beginning part, but the end part not work.
echo "package:/data/app/~~6qMr1wvTvXFW_ceh1ptDHA==/com.sample.touch-tOazIbhNj63ME76BG6zrsA==/base.apk=com.sample.touch" |sed -E 's/package:([^ ]+apk)/\1/'
/data/app/~~6qMr1wvTvXFW_ceh1ptDHA==/com.sample.touch-tOazIbhNj63ME76BG6zrsA==/base.apk=com.sample.touch
The expected output:
/data/app/~~6qMr1wvTvXFW_ceh1ptDHA==/com.sample.touch-tOazIbhNj63ME76BG6zrsA==/base.apk