RegEx for Removing Non-Ascii Chars Except Certain Whitespaces

Thierry Douez th.douez at gmail.com
Wed Jan 29 10:43:34 EST 2014


2014-01-29 Ender Nafi Elekcioglu <endernafi at keehuna.com>:

> The statement should clear all whitespaces and non-ascii chars except dash and space.
>
> ~ Ender


[ ...]  -> character class; match any characters in between the brackets
[^...] -> character class; do *NOT* match all characters in between the brackets

So, you can try something like:

put replacetext( mytext, "[^a-zA-Z0-9]", empty) into mytext

a-z  -> any chars from a to z
A-Z  -> any chars from A to Z

Still missing the dash; add it inside the brackets:

put replacetext( mytext, "[^a-zA-Z0-9-]", empty) into mytext

and carry on adding extra chars until you are happy.

Does that makes sense?


Thierry

------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage - sunnYpdf




More information about the use-livecode mailing list