I want to create a turtle pattern that is the equivalent of a "lookbefore" in Regex. From the docs, it looks like this can work, using the skip
pattern e.g like this:
match (skip "key:" <> chars) "key:value" -- "value"
But I get a type error
<interactive>:34:24: error:
• Couldn't match type ‘Text’ with ‘()’
Expected: Pattern ()
Actual: Pattern Text
• In the second argument of ‘(<>)’, namely ‘chars’
In the first argument of ‘match’, namely ‘(skip "key: " <> chars)’
In the expression: match (skip "key: " <> chars) "key:value"
How can I make this work, and if not, is there another way to achieve the desired behavior?
You can do this by first running the
skip
parser, and then return the value forchars
, so: