Effect CommunityEC
Effect Community2y ago
6 replies
Graeme

Parsing and Extracting Parts from a Non-JSON String

Hello! I keep running into situations where I need to parse a non-JSON string and pull parts out of it. For (contrived) example, I have an Authorization header that might contain Bearer xxx. I already have a Schema for the xxx part that I'd like to use, and I could use Schema.literal('Bearer ') for the rest. Is there an example of how to do this? I've tried using regex but found it quite verbose/messy as the captured groups aren't readily available.
Was this page helpful?