Suggestions for Regex QA check: Verb "click" must be followed by preposition "on"

Hello,

Disclaimer: I'm a beginner where Regex is concerned, so apologies if this is a silly question!

I'd like to set up a Regex QA check to flag up target segments where I've forgotten to use the preposition "on" after the verb "click".

The best I've come up with is to enter Click [^o] in the RegEx target box, with "Report if target matches (target check only)" as the condition. But obviously this is case sensitive and doesn't cover "clicks", "clicking", "clicked".

Does anyone have any suggestions for a more "comprehensive" rule that would save me entering all the different variants (click, Click, CLICK, clicking, Clicking, CLICKING and so on and so on...!)?

Thanks,

Hayley

Parents Reply
  • Rather than specifying explicit suffixes in Raphaël’s solution (such as “s|ed|ing”), using the generic \w* metacharacter with quantifier click\w*(?!\son) can simplify the regex when many variants need to be coded, but results in an interesting phenomenon in conjunction with negative lookahead; backtracking can cause “false matches”, such as “clicking on”. This problem can be avoided with an atomic group, which is probably the least understood regex construct because almost all regex textbooks provide a very poor description with abstruse examples; an atomic group (?>…) prevents backtracking. The correct regex is click(>\w*)(?!\son)

    To prevent false positives, such as “click one button”, it may be better to code (?!\son\b)

Children