Applescript: Detecting Regex of a JSON return

What's the Regex (for alternate icon) if you're outputting a JSON?

return "{\"text\":\"Connect\",\"font_size\": 15}"

VS

return "60%
94%"
1 Like

Something like ^(?!\s*$).+ checks if the content (string) is anything but an empty space.
So, if you return JSON (or anything else) then the string is not empty, and hence the regex above should return true (and activate your alternate icon)

Hope that helps.

does this work with the above scenario though? They both have text for them.

BTT only runs the regex on the text part of the json, so there is no difference whether you return JSON or a normal string.

1 Like

Damn, I forgot what i was aiming to do, as its been so long. Anyway,

/({\\\"text\\\":)

should work i guess...
regexr.com/4ftht