How to clean x of non alphabets or digits

How can I remove every character from string except digits or alphabets? example:

dirty x:

x = as-.213sadf34-.-&ยค%#

cleaned x:

x = as213sadf34

1 answer

  • answered 2017-12-06 01:49 Allan

    Since I don't know which language your are using, I will propose the following high level way of processing:

    1. Fetch all the strings you want to clean from your file
    2. Use the following regex [^\da-zA-Z] on all your strings and replace the match by the empty string ''