parse_regex_pattern | R Documentation |
stringmagic
's regular expression parserParse regular expression with custom flags and obtain the final pattern to be parsed as well as the vector of flags
parse_regex_pattern(
pattern,
authorized_flags,
parse_flags = TRUE,
parse_logical = TRUE,
envir = parent.frame()
)
pattern |
Character scalar, the regular expression pattern to parse. |
authorized_flags |
Character vector representing the flags to be parsed. Use the empty string if no flags are allowed. |
parse_flags |
Logical scalar, default is |
parse_logical |
Logical scalar, default is |
envir |
An environment, default is |
This is an internal tool that is exposed in order to facilitate checking what's going on.
There is no error handling.
This function always returns a list of 4 elements:
flags
: the character vector of flags. If no flags were found, this is the empty string.
patterns
: the vector of regex patterns.
is_or
: logical vector of the same length as patterns
. Indicates for each
pattern if it should be attached to the previous patterns with a logical OR (FALSE
means a logical AND
).
is_not
: logical vector of the same length as patterns
. Indicates for each pattern
if it should be negated.
Laurent Berge
String operations: string_is()
, string_get()
, string_clean()
, string_split2df()
.
Chain basic operations with string_ops()
. Clean character vectors efficiently
with string_clean()
.
Use string_vec()
to create simple string vectors.
String interpolation combined with operation chaining: string_magic()
. You can change string_magic
default values with string_magic_alias()
and add custom operations with string_magic_register_fun()
.
Display messages while benefiting from string_magic
interpolation with cat_magic()
and message_magic()
.
Other tools with aliases:
cat_magic_alias()
,
string_magic()
,
string_magic_alias()
,
string_ops_alias()
,
string_vec_alias()
parse_regex_pattern("f/hello", c("fixed", "ignore"))
x = "john"
parse_regex_pattern("fm/{x} | Doe", c("fixed", "ignore", "magic"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.