Q&A about the site for members of the workforce navigating the professional setting
--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##) a.Id AS [Post Link], url = 'site://posts/' + CAST(a.Id AS varchar)+'/revisions', a.OwnerUserId AS [User Link], a.CreationDate, a.LastActivityDate, a.Score, a.Body FROM Posts a JOIN Posts q ON a.ParentId=q.Id WHERE (a.Body LIKE '%[^\]##text?\C##[^a-zA-Z]%') AND NOT ((a.Body LIKE '%\newcommand{##text##}%') OR (a.Body LIKE '%\DeclareMathOperator{##text##}%') OR (a.Body LIKE '%\def{##text##}%')) AND ((q.Body LIKE '%\newcommand{##text##}%') OR (q.Body LIKE '%\DeclareMathOperator{##text##}%') OR (q.Body LIKE '%\def{##text##}%')) ORDER BY a.CreationDate DESC