Skip to content

Instantly share code, notes, and snippets.

@soar
Last active April 24, 2017 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soar/051bfabd92b957c04d1d7195afd9c058 to your computer and use it in GitHub Desktop.
Save soar/051bfabd92b957c04d1d7195afd9c058 to your computer and use it in GitHub Desktop.
MySQL magic
SELECT
_utf8 'а' REGEXP CONCAT('^([', x'D0B0', '-', x'D18F', '])*$') as rus_a_regex_check,
HEX('а') as rus_a_hex,
_utf8 'г' REGEXP CONCAT('^([', x'D0B0', '-', x'D18F', '])*$') as rus_g_regex_check,
HEX('г') as rus_g_hex,
_utf8 'т' REGEXP CONCAT('^([', x'D0B0', '-', x'D18F', '])*$') as rus_t_regex_check,
HEX('т') as rus_t_hex,
_utf8 'у' REGEXP CONCAT('^([', x'D0B0', '-', x'D18F', '])*$') as rus_y_regex_check,
HEX('у') as rus_y_hex,
_utf8 'я' REGEXP CONCAT('^([', x'D0B0', '-', x'D18F', '])*$') as rus_ya_regex_check,
HEX('я') as rus_ya_hex
;
*************************** 1. row ***************************
rus_a_regex_check: 1
rus_a_hex: D0B0
rus_g_regex_check: 1
rus_g_hex: D0B3
rus_t_regex_check: 0
rus_t_hex: D182
rus_y_regex_check: 0
rus_y_hex: D183
rus_ya_regex_check: 1
rus_ya_hex: D18F
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment