问题
rule: [while [not ["--"] skip] some "-"]
parse "a-bc----d" [rule ??]
prints
??: "d"
But I need a more efficient rule (e.g. using to #"-"
)...
EDIT:
t: copy "" append/dup t "." 10000 append t "-..---..--"
rule: [while [not ["--"] skip] some "-"]
print [delta-time [loop 1000 [parse t [rule] ]]]
=> ~ 15.4 sec on my phone
rule: [any ["--" break | skip] any "-"]
=> ~ 8.2 sec
rule: [to "--" some "-"]
(@sqlab response)
=> ~ 0.3 sec
回答1:
What prevents you to use to as e.g.
rule: [to "--" some "-" x:]
来源:https://stackoverflow.com/questions/54560201/rebol-parse-rule-to-match-thru-first-occurrence-of-at-least-2-spaces