pngroup: Parallel n-th Capture Group

Description Usage Arguments Examples

Description

Extract and return n-th regex capure group of the pattern matching the string. Arguments are vectorized in the mapply way.

Usage

1
pngroup(string, pattern, n = 1, perl = FALSE)

Arguments

string

character vector

pattern

vector of regular expressions

n

index of capture group to return

perl

use perl regex – TRUE/FALSE?

Examples

1
2
3
pngroup("one two three", "(.+)\\s(.+)\\s(.+)", 4) # "three"
pngroup(c("one two three", "four five six"), "(.+)\\s(.+)\\s(.+)", 2) # "one"  "four"
pngroup(c("one two three", "four five six"), "(.+)\\s(.+)\\s(.+)", 2:4) # "one"   "five"  "three"

avidclam/amxtra documentation built on May 17, 2019, 12:01 p.m.