re_compile {re} | R Documentation |
re_compile
compiles a regular expression pattern with specified flags. This function allows setting
various flags akin to regex modifiers in other programming languages like Python. The flags control various aspects
of pattern matching. This function is really just a way to set flag arguments with a constant variable.
re_compile(pattern, IGNORECASE, I, MULTILINE, M, DOTALL, S, VERBOSE, X, NOFLAG)
pattern |
The regular expression pattern to be compiled. |
IGNORECASE |
Flag to indicate case-insensitive matching. |
I |
Abbreviation for IGNORECASE. |
MULTILINE |
Flag to indicate multi-line matching, where |
M |
Abbreviation for MULTILINE. |
DOTALL |
Flag to indicate that |
S |
Abbreviation for DOTALL |
VERBOSE |
Flag to allow a more verbose regex syntax, which can include comments and whitespace for readability. |
X |
Abbreviation for VERBOSE |
NOFLAG |
Flag to indicate that no flags should be set. |
An object of class "Pattern" representing the compiled regular expression with the specified flags.
Python re.compile() documentation
pattern <- re_compile("^abc", IGNORECASE)
pattern <- re_compile("end$", M = TRUE)
pattern <- re_compile("a.b", DOTALL = TRUE)