cs-au-dk/dk.brics.automaton

How to match all not containing a specific string?

frankbenoit opened this issue · 3 comments

Hi

this library is used in Gerrit.
In Gerrit i try to install a mechanism to add reviewer only if the commit message does not start with "!!NOT_READY!!"

If it would be standard regex, i think i could use:
message:^(?!!!NOT_READY!!).*

How can i do this in gerrit using dk.brics.automaton ?

BR
Frank

Please read the documentation (http://www.brics.dk/automaton/), including the first item of the FAQ (http://www.brics.dk/automaton/faq.html).

It is not like the internet is flooding with examples and answered questions about this library.
And i try to use this only seeing the Gerrit search field, not using the java API.

Would you be so kind and give a bit more details please?
Is it possible and how?

I tried in gerrit: message:^~!!NOT_READY!! it is not working.

The syntax for regular expressions is described here: http://www.brics.dk/automaton/doc/index.html?dk/brics/automaton/RegExp.html
Try new RegExp("!!NOT_READY!!@"). It will match all strings that start with "!!NOT_READY!!". @ means the same as .*.