Reproduction steps
- Attempt to use Herald as a new user
- Become extremely confused and frustrated
Version Information
- The current live docs
Struggle with this yesterday and today until I figured out what was going wrong.
When creating a Herald rule to mail me when certain code pattern appear I couldn't for the life of me get it to run against a commit in the Test Console that I knew to contain this pattern. I was using matches regex (for both the affected files and the diff contents) and it was unclear as to whether I should of been writing:
- /\.js$/
- "/\.js$/"
- "/\\.js$/"
- @/\.js/@
- @/\.js/@
- @/\\.js/@
- @\.js@ <- The correct answer for matches regexp
Telling me that I need to use the enclosing character "@" is fine. Giving me an example (in the error messages) that says the following is fine as well.
throw new HeraldInvalidConditionException( pht( 'The regular expression "%s" is not valid. Regular expressions '. 'must have enclosing characters (e.g. "@/path/to/file@", not '. '"/path/to/file") and be syntactically correct.', $condition_value));
But it wasn't clear to me that I needed to use option 7 as listed above.
Could you please place some more information about the finer points of using this feature in the docs. I struggled to figure out how to use the matches regexp pairs as well. Overall there should be some real examples of things people would want to do... like me wanting to hone in on just certain files types... and then honing in on a particular word/pattern.
There is an example in there for matches regexp pairs which is what I managed to use in the end, not without a lot of hassle of back and forth to the Test Console with no clear explanation as to why it wasn't finding a pattern that definitely in the code.