It is not necessary to put .*
or .*?
into the beginning or end of regular expressions to match something anywhere inside the string. So for example regcomp(®ex, ".*ab+c")
can be replaced with the simpler: regcomp(®ex, "ab+c")
. If you wish to match and extract the prefix, you should say (.*?)
or (.*)
.