I am trying to create regular expression with condition: "Or maslo until space, dash or end of line, or starting with mas and then any character from one to infinity except of space or dash".
{
"regexp": {
"name": {
"value": "(maslo( |-|$)|mas[^ \-]+)"
}
}
}
This expression [^ \-] should be correct, according to Regexp Query Documentation, paragraph "Character classes", last line, which says:
[^abc\-] # any character except '-' or 'a' or 'b' or 'c'
But I am receiving error:
{
"type": "json_parse_exception",
"reason": "Unrecognized character escape '-' (code 45)\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@2a7b147b; line: 8, column: 47]"
}
Am I missing something? Thanks for any advice.