How To use MYSQL Select Query to find an Apostrophe followed by an Uppercase letter, made from a typo (typographic) error

41 Views Asked by At

I needed an MySQL Query to find all rows which contained a text pattern like

It'S hot

(an apostrophe followed by an uppercase letter), made by mistake (a typo), when the typist held the shift key too long while typing fast.

1

There are 1 best solutions below

1
Steve Wasiura On
SELECT artist, title
  FROM songs 
  WHERE BINARY title REGEXP '^.*\'[A-Z]+'

BINARY forces case sensitivity,

^ starts at beginning of data field,

.* matches any character(s)

\\' escapes a single quote

[A-Z] matches uppercase A thru Z

\+ matches anything after it, even nothing i.e. end of line