string="1!2! 3 4"
so remove all " " and "!"
how can i do this
Since you're using IC613 (from your previous post), you could use the newer "pcre" (Perl Compatible Regular Expression) functions which are more powerful than the older "rex" functions. For example:
pat=pcreCompile("[!\\s]")string=pcreReplace(pat string "" 0)
The \\s (extra escape needed because the pattern really needs a backslash, but backslash is used in SKILL, so needs to be escaped) means whitespace. So it will match space, tab, etc.
You could also use the older functions:
rexCompile("[! ]")string=rexReplace(string "" 0)
The PCRE-based functions are really powerful, and so I'd recommend those in general if you don't need to make code also work in IC5141 (which only had the older rex functions)
In reply to Andrew Beckett:
that works fine.
I use the pcreCompile pcreReplace functions but i want to replace all white space in my string with \| .
test = "aaa bbb ccc"
test=pcreReplace(pat test "\\|" 0)
=> "aaa|bbb|ccc" and not "aaa\|bbb\|ccc" .
How can i do this ? How can i put a "\"?
Best Regards Mat.