For example,
say string is “-u xyz -p 1234 -z ask -p secure -o all -p demo”
I would like to get match all the occurrences of -p and get the values of it,
I tried but it only gives stops at the first match,
$command =~ /(.*)\-p\s+(.*?)\s+(.*)/g; print $2
which will result in
1234
Any idea, how can I recur it and get all the values: 1234, secure, demo
This will work for the example:
result: