Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix CompileRegex not actually setting a valid error code. #775
CompileRegex is currently setting the error code to the offset of where the error occurred rather than the actual error.
To fix this pcre_compile was replaced with pcre_compile2 and a map used to convert the pcre error to a simpler (posix) error code but maintaining pcre's error string and adding the error codes to the enum. Also changed the internal member names since it was rather confusing. In the future we can also add in the offset so we can pass the offset where the error occurred.
The reason for mapping the errors is that pcre's error codes dont seem to be documented at all(?) From pcre_internal.h the errors are named ERR0, ERR1 etc... and i couldn't find any more information. There is also over 80 of them (due to the amount of detail) so I think the posix error codes are a simpler approach.
Small test plugin and its output.