I am attempting to search for a string in order to match on several capture groups. In the case of two such capture groups the data is optional, so they may or may not match. I am using pcregrep with option -onumberto return the various capture groups. The question is: how can I return default value in the case no values match. I tried to use disjunctive but without success.
Example:
../pcre-8.32/pcregrep -Min -o1 -o2 --om-separator="; " '(?s)<!-- BOUNDARY -->(?!.*?Read the full review).*?((\d*) of (\d*) people found the following review helpful|.*?).*?Help other customers find the most helpful' shirts/B000W18VGW
produces the correct line numbers.
-Min -o1 -o2 --om-separator="; " '(?s)<!-- BOUNDARY -->(?!.*?Read the full review).*?(\d*) of (\d*) people found the following review helpful.*?Help other customers find the most helpful' shirts/B000W18VGW
produces the correct output but only for the lines with
(\d*) of (\d*) people found the following review helpful
If the line above does not exists I would like to return "0" for each of the capture groups.
Is this possible and if so how?