Macro in a comment defined in the question (including comments to the answers)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

;  with commentsquestions_cte as
(
SELECT q.Id AS qId, c.Id AS cId, c.Text AS cText, c.UserId as cOwner, c.CreationDate AS cDate, q.Body AS qBody
FROM Posts q INNER JOIN Posts a ON (a.ParentId=q.Id)
  INNER JOIN Comments c ON (c.PostId=a.Id)
    UNION
SELECT q.Id AS qId, c.Id AS cId, c.Text AS cText, c.UserId as cOwner, c.CreationDate AS cDate, q.Body AS qBody
FROM Posts q INNER JOIN Comments c ON (c.PostId=q.Id AND q.PostTypeId=1)
)
--- the pairs Comments.Id and Questions.Id
--- where comment is posted anywhere on the page
--- (comment to the question or to any of the answers)

SELECT TOP(##num?50##)
  cId AS [Comment Link], cText, cOwner AS [User Link], cDate
FROM commentsquestions_cte
WHERE (cText LIKE '%[^\]\##text?Chi##[^a-zA-Z]%')
  AND NOT ((cText LIKE '%\newcommand{\##text##}%')
    OR (cText LIKE '%\DeclareMathOperator{\##text##}%')
    OR (cText LIKE '%\def\##text##%'))
  AND ((qBody LIKE '%newcommand{\##text##}%')
    OR (qBody LIKE '%newcommand\##text##%')
    OR (qBody LIKE '%newcommand{##text##}%')
--we want to catch both \renewcommand and \newcommand    
    OR (qBody LIKE '%\DeclareMathOperator{\##text##}%')
    OR (qBody LIKE '%\DeclareMathOperator{##text##}%')
    OR (qBody LIKE '%\DeclareMathOperator\##text##%')
    OR (qBody LIKE '%\def\##text##%'))
ORDER BY cDate DESC

Enter Parameters

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