Fork of All articles with trailing special characters missing redirects by Anomie
This query is marked as a draft This query has been published by Anomie.

SQL

AخA
 
SELECT
  p1.page_namespace AS ns,
  p1.page_title AS title,
  REGEXP_REPLACE( CONVERT(p1.page_title USING utf8), IF(p1.page_title LIKE '%(%', '[_,;.:!?]+$', '[_,;.:!?)]+$' ), '' ) AS target
FROM
  page as p1
  LEFT JOIN page AS p2 ON ( p1.page_namespace = p2.page_namespace AND REGEXP_REPLACE( CONVERT(p1.page_title USING utf8), IF(p1.page_title LIKE '%(%', '[_,;.:!?]+$', '[_,;.:!?)]+$' ), '' ) = p2.page_title )
  LEFT JOIN redirect AS r1 ON(r1.rd_from=p1.page_id)
WHERE
  (
    p1.page_title LIKE '%,'
    OR p1.page_title LIKE '%;'
    OR p1.page_title LIKE '%.'
    OR p1.page_title LIKE '%:'
    OR p1.page_title LIKE '%!'
    OR p1.page_title LIKE '%?'
    OR p1.page_title LIKE '%)' AND p1.page_title NOT LIKE '%(%'
  )
  AND p1.page_namespace=0
  AND REGEXP_REPLACE( CONVERT(p1.page_title USING utf8), '[_,;.:!?)]+$', '') != ''
  AND p2.page_id IS NULL
  AND r1.rd_from IS NOT NULL
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.

Checking query status...