1

I want to replace all the special character with space ,I tried this below query its working partially ,

UPDATE
  inventory_set_variations
SET
  title =
REPLACE
  (
  REPLACE
    (
    REPLACE
      (
      REPLACE
        (
        REPLACE
          (
        REPLACE
          (title,
          '-',
          ''),
          '+',
          ''
        ),
        '.',
        ''
      ),
      '(',
      ''
    ),
    ')',
    ''
  ),
  ' ',
  ''
)
WHERE
  isvid = 1009638

here i want to replace all the special character with space and want to keep only alpha numeric character.

is there any suggestion ?

sradha
  • 2,216
  • 1
  • 28
  • 48
  • 3
    This may help https://stackoverflow.com/questions/6942973/how-to-remove-all-non-alpha-numeric-characters-from-a-string – RiggsFolly Feb 05 '18 at 12:58
  • If you use MariaDB: https://stackoverflow.com/a/26179601/42139. Note that the regex would be very simple, something like: `[^a-zA-Z0-9]` – jeroen Feb 05 '18 at 12:59
  • In php you can try preg_replace('/[^A-Za-z0-9\-]/', '', $title) and then set title in update column. – Binit Ghetiya Feb 05 '18 at 13:00
  • I want it in mysql – sradha Feb 05 '18 at 13:01
  • 1
    Possible duplicate of [How to remove all non-alpha numeric characters from a string?](https://stackoverflow.com/questions/6942973/how-to-remove-all-non-alpha-numeric-characters-from-a-string) – Chris Lear Feb 05 '18 at 13:05

0 Answers0