This error is due to usage of < or > symbols. Do not use < or > symbols. Use < and > instead.
Example:
rex field=_raw "errorCode: (?<error_code>d+)"
The above usage in the query will throw an error due to usage of < and > symbols. See the following resolution to resolve this issue.
rex field=_raw "errorCode: (?<error_code>d+)"