重复PARSE规则以匹配至少2个空格的首次出现

时间:2019-02-06 18:24:30

标签: parsing rebol red

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秒

rule: [any ["--" break | skip] any "-"]

=>〜8.2秒

rule: [to "--" some "-"](@ sqlab响应)

=>〜0.3秒

1 个答案:

答案 0 :(得分:3)

是什么使您无法使用 to 作为

rule: [to "--" some "-"  x:]