I would like to use regular expression from here:
https://www.rfc-editor.org/rfc/rfc3986#appendix-B
I am trying to compile it like this:
#include <regex.h>
...
regex_t regexp;
if((regcomp(®exp, "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(?([^#]*))?(#(.*))?", REG_EXTENDED)) != 0){
return SOME_ERROR:
}
But I am stuck with return value of regcomp:
REG_BADRPT
According to man it means:
Invalid use of repetition operators such as using *
as the first character.
Similar meaning at this man:
?
, *
or +
is not preceded by valid regular expression
I wrote parser using my own regular expression, but I would like to test this one too, since its officially in rfc. I do no intend to use it for validation though.
See Question&Answers more detail:os