Q&A about the site for professional linguists and others with an interest in linguistic research and theory
--We do not want the macro to be followed by alphanumerical character --For example we want to match: \C but not \Cov, \norm but not \normalsize, \Q but not \quad --thanks to rene for suggestion to use regex: https://chat.meta.stackexchange.com/transcript/1223/2019/2/1 SELECT TOP(##num?50##) c.Id AS [Comment Link], c.text, c.UserId AS [User Link], c.CreationDate FROM Comments c JOIN Posts p ON c.PostId=p.Id WHERE (c.Text LIKE '%[^\]##text?\C##[^a-zA-Z]%') AND ((p.Body LIKE '%\newcommand{##text##}%') OR (p.Body LIKE '%\DeclareMathOperator{##text}%') OR (p.Body LIKE '%\def{##text}%')) ORDER BY c.CreationDate DESC