pRegex: Create a Primitive Parser from a Regex

View source: R/Combin8R.R

pRegexR Documentation

Create a Primitive Parser from a Regex

Description

Create a parser to parse text matching a regular expression.

Usage

pRegex(tag, regex)

Arguments

tag

a class name or a function of a single argument that constructs an object representing the result of the parse.

regex

A regular expression that defines the text to be parsed.

Details

This function creates a parser that accepts input that matches a regular expression.

The regex defining a match will usually begin with the "^" beginning of string anchor.

The tag argument should either be a string naming the class of the result, or a function that constructs a object representing the result of the parse, given the first row of the character matrix returned by stri_match_first_regex.

Value

Returns a parser.


SWotherspoon/Combin8R documentation built on June 10, 2025, 6:15 a.m.