Answers containing a macro defined in the question

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

--parameter should be "Cov" if you are looking for \Cov
--notice that both \DeclareMathOperator{\Cov}{Cov} and
--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?Chi##[^a-zA-Z]%')
  AND NOT ((a.Body LIKE '%\newcommand{\##text##}%')
    OR (a.Body LIKE '%\newcommand\##text##%')
    OR (a.Body LIKE '%\newcommand{##text##}%')
    OR (a.Body LIKE '%\DeclareMathOperator{\##text##}%')
    OR (a.Body LIKE '%\DeclareMathOperator\##text##%')
    OR (a.Body LIKE '%\DeclareMathOperator{##text##}%')
    OR (a.Body LIKE '%\def{\##text##}%')
    OR (a.Body LIKE '%\def\##text##%'))
--notice that both \DeclareMathOperator{Aut}{Aut} and \DeclareMathOperator{\Aut}{Aut} give the same result in MathJax
  AND ((q.Body LIKE '%newcommand{\##text##}%')
    OR (q.Body LIKE '%newcommand\##text##%')
    OR (q.Body LIKE '%newcommand{##text##}%')
--we want to catch both \renewcommand and \newcommand    
    OR (q.Body LIKE '%\DeclareMathOperator{\##text##}%')
    OR (q.Body LIKE '%\DeclareMathOperator\##text##%')
    OR (q.Body LIKE '%\DeclareMathOperator{##text##}%')
    OR (q.Body LIKE '%\def{\##text##}%')
    OR (q.Body LIKE '%\def\##text##%'))
ORDER BY a.CreationDate DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results