grapes-twiddle-grapes: regular sub-expression matching

%~%R Documentation

regular sub-expression matching

Description

This simplifies the syntax of regular expression matching.

Usage

text %~% pattern

Arguments

text

text to match against pattern

pattern

regular expression pattern (can have subexpressions)

Value

a list of the same length as text, with lists of matches in each item

Examples

match some math expressions:
x <- c('2*x^2','x','3')
x %~% '([0-9]*)[*]?x?(\\^[0-9]+)?'
[[1]]
[1] "2*x^2" "2"     "^2"

[[2]]
[1] "x" ""  ""

[[3]]
[1] "3" "3" ""

a-kramer/SBtabVFGEN documentation built on Nov. 14, 2024, 8:41 p.m.