我想删除字符串中的所有字符,除了:
-
或_
或.
A
直通Z
a
直通z
0
到9
- 空间
在 linux 命令行上,使用sed
我会这样做:
$ echo "testing-#$% yes.no" | sed 's/[^-_.a-zA-Z0-9 ]//g'
输出:
testing- yes.no
如何使用 PARSE 在 Red 语言中实现相同的效果?我在看:
- http://www.rebol.com/docs/core23/rebolcore-15.html#section-1
- http://rebol-land.blogspot.in/2013/03/rebols-answer-to-regex-parse-and-rebol.html
- http://ross-gill.com/page/Beyond_Regular_Expressions
但是,我无法对其进行编码。我试过:
>> parse "mystring%^&" [#a - #z #A - #Z #0 - #9]
== false
>> parse "mystring%^&" [#a-#z#A-#Z#0-#9]
== false