Rebol PARSE 规则匹配至少 2 个空格的第一次出现
Rebol PARSE rule to match thru first occurrence of at least 2 spaces
rule: [while [not ["--"] skip] some "-"]
parse "a-bc----d" [rule ??]
打印
??: "d"
但我需要一个更有效的规则(例如使用to #"-"
)...
编辑:
t: copy "" append/dup t "." 10000 append t "-..---..--"
rule: [while [not ["--"] skip] some "-"]
print [delta-time [loop 1000 [parse t [rule] ]]]
=> ~ 15.4 秒在我的 phone
rule: [any ["--" break | skip] any "-"]
=> ~ 8.2 秒
rule: [to "--" some "-"]
(@sqlab 回复)
=> ~ 0.3 秒
是什么阻止您使用 到 ,例如
rule: [to "--" some "-" x:]
rule: [while [not ["--"] skip] some "-"]
parse "a-bc----d" [rule ??]
打印
??: "d"
但我需要一个更有效的规则(例如使用to #"-"
)...
编辑:
t: copy "" append/dup t "." 10000 append t "-..---..--"
rule: [while [not ["--"] skip] some "-"]
print [delta-time [loop 1000 [parse t [rule] ]]]
=> ~ 15.4 秒在我的 phone
rule: [any ["--" break | skip] any "-"]
=> ~ 8.2 秒
rule: [to "--" some "-"]
(@sqlab 回复)
=> ~ 0.3 秒
是什么阻止您使用 到 ,例如
rule: [to "--" some "-" x:]