Fork me on GitHub
#instaparse
<
2022-02-02
>
ghaskins18:02:35

Hi All, I’m trying to understand a failure related to trying to exclude “[” via regex negation

ghaskins18:02:55

this grammar snippet

<unquoted-literal> ::= #"[^()\[\s]+"

ghaskins18:02:16

triggers insta/failure? to return true but there is no info provided

ghaskins18:02:29

<unquoted-literal> ::= #"[^()\s]+"

ghaskins18:02:55

and it seems to be fine from a clojure/jvm regex perspective

ghaskins18:02:56

(re-find #"[^\[]+" "[foo]")
=> "foo]"
(re-find #"[^()\[]+" "[foo]")
=> "foo]"
(re-find #"[^()\[\s]+" "[ foo]")
=> "foo]"

ghaskins18:02:56

(im totally open to other/better ways to parse this outside of regex, too

ghaskins18:02:23

any help appreciated

ghaskins18:02:26

nm, i figured it out