Tries to match everything until (value) the separator.
value
Available since: v1.0.0-alpha.13
v1.0.0-alpha.13
const everythingUntil: (separator: Parser) => (value: Parser, name?: string) => Parser;
In this example we are going to parse the string "Hello" everythingUntil braces.
"Hello"
import { everythingUntil, string, sequenceOf, regex } from "rudus"; const everythingUntilSemicolon = everythingUntil(string(";")); const parser = everythingUntilSemicolon(sequenceOf([regex(/[a-z]+/), regex(/[0-9]+/)])); const result = parser.run("HelloWorld1337;");
The result of the parser above will be:
result
{ "input": "HelloWorld1337;", "isError": false, "offset": 15, "result": ["HelloWorld", "1337"]}