Ash*_*ley 8 parsing rebol rebol3
Rebol2对FIND函数有一个/ ANY细化,可以进行通配符搜索:
>> find/any "here is a string" "s?r"
== "string"
Run Code Online (Sandbox Code Playgroud)
我在需要运行良好的紧密循环中广泛使用它.但是在Rebol3中删除了细化.
在Rebol3中最有效的方法是什么?(我猜是某种parse解决方案.)
以下是处理“*”情况的尝试:
like: funct [
series [series!]
search [series!]
][
rule: copy []
remove-each s b: parse/all search "*" [empty? s]
foreach s b [
append rule reduce ['to s]
]
append rule [to end]
all [
parse series rule
find series first b
]
]
Run Code Online (Sandbox Code Playgroud)
使用如下:
>> like "abcde" "b*d"
== "bcde"
Run Code Online (Sandbox Code Playgroud)