Find records containing characters other than letters, spaces, and periods among the 7 million records stored in MYSQL VER 8
P粉132730839
P粉132730839 2024-02-25 21:01:35
0
1
460

I inserted special characters in MYSQL DB, as shown in the example below, mainly in the first name, last name columns of the database.

<强>1. ➡️BALPAI SAB

<强>2. ��������������������������°���������������������� ������������������������������������������������� ���������������������������������������������� ??

Effective cases:

*Saurabh Shree

S.shree

T.M. Anthony

Charles Babbage Sr.*

The length is variable. Everything is case-insensitive and there are no trailing spaces. Only spaces and periods are allowed between two consecutive words.

I've looked through regexp posts and changed the collation of columns and tables to utfmb4_unicode_ci and applied regexp but no luck.

I had to search around 7 million records for the occurrence of even a single character.

SELECT FARMER_BRANCH_NAME, HEX(FARMER_BRANCH_NAME) FROM BSBY.PROPOSAL

OUTPUT

Farmer Branch Name      Hex(Farmer Branch Name)
SME œ•œBRANCH JASDANœ•œ   534D45209C959C4252414E4348204A415344414E9C959C
নলহাটি        E0A6A8E0A6B2E0A6B9E0A6BEE0A69FE0A6BF
নলহাটি        E0A6A8E0A6B2E0A6B9E0A6BEE0A69FE0A6BF
নলহাটি        E0A6A8E0A6B2E0A6B9E0A6BEE0A69FE0A6BF
SME œ•œBRANCH JASDANœ•œ   534D45209C959C4252414E4348204A415344414E9C959C
Mumbai - Chembur         4D756D626169202D204368656D627572C2A0
New Delhi - Connaught Place - II   4E65772044656C6869202D20436F6E6E617567687420506C616365202D204949C2A0
Mumbai - Malad            4D756D626169202D204D616C6164C2A0
Bangalore - Cantonment    42616E67616C6F7265202D2043616E746F6E6D656E74C2A0
Ahmedabad-BOPAL           41686D6564616261642D424F50414CC2A0
SME œ•œBRANCH JASDANœ•œ    534D45209C959C4252414E4348204A415344414E9C959C

SELECT FARMER_NAME,HEX(FARMER_NAME) FROM BSBY_UAT.PROPOSAL where FARMER_NAME NOT REGEXP '[A-Za-z0-9.() ]$' 

OUTPUT

FARMER NAME         HEX(FARMER NAME)
RAHIM BISWAS        524148494D2042495357415309
ESARUL GAZI         45534152554C2047415A4909
GOLAM NABI MANDAL   474F4C414D204E414249204D414E44414C09
LATIF MANDAL        4C41544946204D414E44414C09
NILKAMAL MANDAL     4E494C4B414D414C204D414E44414C09
SHUKUR ALI MONDAL   5348554B555220414C49204D4F4E44414C09
¦€ Â¦€° Â¦€º Â§Â Â¦€¢  Â¦€  Â¦Â² Â¦Â¿  A0C2A680A0C2A680B0A0C2A680BAA0C2A7C281A0C2A680A220A0C2A680A0A0C2A6C2B2A0C2A6C2BF
HASINA KHATUN       484153494E41204B484154554E09
KSHETRAGOPAL GHOSH  4B534845545241474F50414C2047484F534809
SUKUMAR DAS HALDAR  53554B554D4152204441532048414C44415209
Yasin Hossain       596173696E20486F737361696E09
SHAH HOSSAIN MOLLA  5348414820484F535341494E204D4F4C4C4109
RAMJAN SEKH         52414D4A414E2053454B4809
Nibaran Ch. Mahato  4E69626172616E2043682E204D616861746F09
PRAKASH KUMAR MONDAL 5052414B415348204B554D4152204D4F4E44414C2009
UNFERA BEWA          554E4645524120424557410909
BODRUL HOQUE        424F4452554C20484F5155450909
à¦à¦¾à¦¦à¦² চনà§à¦¦à§à¦° সরকার    E0A6E0A6BEE0A6A6E0A6B220E0A69AE0A6A8E0A78DE0A6A6E0A78DE0A6B020E0A6B8E0A6B0E0A695E0A6BEE0A6B0
à¦à¦¾à¦¦à¦² চনà§à¦¦à§à¦° সরকার    E0A6E0A6BEE0A6A6E0A6B220E0A69AE0A6A8E0A78DE0A6A6E0A78DE0A6B020E0A6B8E0A6B0E0A695E0A6BEE0A6B0
মিনতি সিংহ    E0A6AEE0A6BFE0A6A8E0A6A4E0A6BF20E0A6B8E0A6BFE0A682E0A6B9
রেখা সরকার    E0A6B0E0A787E0A696E0A6BE20E0A6B8E0A6B0E0A695E0A6BEE0A6B0
রেখা সরকার    E0A6B0E0A787E0A696E0A6BE20E0A6B8E0A6B0E0A695E0A6BEE0A6B0
SUKDEB SARKARপ    53554B444542205341524B4152E0A6AA
KEYAMUL SEKH            4B4559414D554C2053454B480909
घोष पारà¥à¤µà¤¤à¥€  E0A498E0A58BE0A4B720E0A4AAE0A4BEE0A4B0E0A58DE0A4B5E0A4A4E0A580
à¦à¦¨à§à¦Ÿà§ সরকার    E0A69DE0A6A8E0A78DE0A69FE0A78120E0A6B8E0A6B0E0A695E0A6BEE0A6B0
à¦à¦²à¦°à¦¾à¦® সরকার  E0A6E0A6B2E0A6B0E0A6BEE0A6AE20E0A6B8E0A6B0E0A695E0A6BEE0A6B0
মনোতোষ সরকার  E0A6AEE0A6A8E0A78BE0A6A4E0A78BE0A6B720E0A6B8E0A6B0E0A695E0A6BEE0A6B0

This is my code:

SELECT distinct(FARMER_APPLICATION_ID) as FARMER_APPLICATION_ID,FARMER_AADHAR_NO,FARMER_EPIC_NO,FARMER_NAME,FARMER_GUARDIAN_NAME,FARMER_CROP_NAME,FARMER_L3_NAME,FARMER_L4_NAME,FARMER_L5_NAME,FARMER_L6_NAME,FARMER_BANK_NAME,FARMER_BANK_IFSC,PARTY_NAME,PARTY_CODE,FARMER_BRANCH_NAME
FROM BSBY_UAT.PROPOSAL 
where FARMER_AADHAR_NO NOT regexp '^[2-9]{1}[0-9]{3}[0-9]{4}[0-9]{4}$'
OR FARMER_BANK_IFSC not regexp '^[A-Z]{4}0[A-Z0-9]{6}$'
OR FARMER_NAME NOT REGEXP '[A-Za-z.() ]$'
OR FARMER_GUARDIAN_NAME NOT REGEXP '[A-Za-z.() ]$'
or FARMER_EPIC_NO NOT REGEXP'[A-Za-z0-9\/]$'
or FARMER_BANK_NAME NOT REGEXP'[A-Za-z.\-() ]$'
or FARMER_BRANCH_NAME NOT REGEXP'[A-Za-z0-9.,()\[\]\-]$'

P粉132730839
P粉132730839

reply all(1)
P粉340980243

This takes "2" in the question; I wonder if it provides any clues:

à ¦
à ¦¿
à ¦•
à §Â
à ¦°
à ¦®
à ¦¾
à ¦¦
à ¦¿
à ¦¤
à §Â
à ¦Â

For one of the hex strings, I see Convert (UNHEX('E0A69DE0A6A8E0A78DE0A69FE0A78120E0A6B8E0A6B0E0A695E0A6BEE0A6B0') using utf8mb4) Produce Jhantu Sarkar

This won't necessarily lead to a solution, but it may suggest an encoding issue during insertion.

For regular expressions, consider something like

HEX(column) REGEXP '^(..)*[89ABCDEF]'

This will discover if any bytes in the string have a non-Ascii 8-bit code.

This is a mixture:

CONVERT(UNHEX('53554B444542205341524B4152E0A6AA') USING utf8mb4) --> 'SUKDEB SARKARপ'

That is, it is Ascii but with the Bengali "PA" at the end. In fact, the "SUKDEB SARKARàª" you see is the Mojibake logo. For a discussion of Mojibake (and other common confusions), see this: Problem with UTF-8 characters; what I see is not the

I stored
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template