REZRegex

Official docs:
https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/regex

options

Usage: word + options(ignore_case=True) word + options('ignore_case') word + options('ignore_case', 'multiline') word + options('ignore_case', multiline=True)

Args:

any_between

Aliases: amt_between, numBetween, num_between, anyBetween, amtBetween

Match any char between char and and_char, using the ASCII table for reference

            Args:
                char (str): the first character
                and_char (str): the second character

any_char_except

Aliases: anythingExcept, any_except, anyExcept, anyCharExcept, anything_except

This matches any char that is NOT in chars. chars can be multiple parameters, or a single string of chars to split.

            Args:
                chars (str): any of the characters to match

any_of

Aliases: anyof, oneof, oneOf, anyOf, one_of

anything

Aliases: anychar, any_char, anyChar, char

Matches any single character, except a newline. To also match a newline, use literally_anything

at_least_none

Aliases: zero_or_more, atLeast0, any_amt, anyAmt, at_least_0, atLeastNone, noneOrMore, zeroOrMore, none_or_more

at_least_one

Aliases: atLeastOne, atLeast1, at_least_1, one_or_more, oneOrMore

chunk

Aliases: stuff

A "chunk": Any clump of characters up until the next newline

either

Aliases: or_, or

Match either pattern or or_pattern. To choose between more than 2 things, you can either chain multiple either calls, or use any_of. Note that the order here matters: it first tries pattern, and if that doesn't match, then it tries or_pattern.

            Args:
                pattern: a pattern to match
                or_pattern: a pattern to match if the first one fails

hex_digit

Aliases: hexDigit, hex

letter

Aliases: alpha

Matches just a letter -- not numbers or _ like word_char

letter_num

Aliases: alphaNum, alphanum, alpha_num, letterNum

line_ends_with

Aliases: lineEndsWith, lineEnd, line_end

Matches at a line if it ends with pattern

            Args:
                pattern: the pattern to match

line_starts_with

Aliases: line_start, lineStart, lineStartsWith

Matches at a line if it starts with pattern

            Args:
                pattern: the pattern to match

match_at_least

Aliases: matchAtLeast, atLeast, at_least, matchMin, match_min

match_at_most

Aliases: atMost, matchAtMost, at_most

match_max

Aliases: matchMax, repeat

match_more_than

Aliases: more_than, matchMoreThan, moreThan, match_greater_than, matchGreaterThan

match_num

Aliases: amt, matchNum, num, matchAmt, match_amt

match_range

Aliases: matchRange, matchBetween, between, match_between

new_line

Aliases: newLine, newline

optional

Aliases: oneOrNone, one_or_none, opt

period

Aliases: dot

signed_integer

Aliases: signed, signed_int, integer, signedInt, signedInteger

A signed integer, that also accepts e notation, like 123, -123+10, or +123e-10

unsigned_integer

Aliases: unsigned_int, unsignedInt, unsignedInteger, unsigned

An unsigned integer, that also accepts e notation, like 123, or +123e-10

white_char

Aliases: whitechar, whiteChar

whitechunk

Aliases: white_space, white_chunk, whiteChunk, whitespace, whiteSpace

A "chunk" of whitespace. Just any amount of whitespace together


Replacement EZRegexs

replace_entire

Aliases: replaceAll, replaceEntire, replace_all

Puts in its place the entire match

rgroup

Aliases: replaceGroup, replace_group

Puts in its place the group specified, either by group number (for unnamed groups) or group name (for named groups). Named groups are typically also counted by number, check your specific dialect docs for details. Group 0 is handled specially by this function, so it calls for the entire match, even if 0 doesn't mean the entire match in your dialect.

        Args:
            num_or_name (int | str): the number or name of the group you want to insert here

replace

Generates a valid regex replacement string, using Python f-string like syntax.

            Args:
                string (str): the templated replacement string
                compile (bool): whether to compile the string into an EZRegex subclass instance (default: True)

            Example:
                ``` replace("named: {group}, numbered: {1}, entire: {0}") ```

            Like Python f-strings, use {{ and }} to specify { and }

            Set the `compile` parameter to False to have it return an EZRegex subclass instance instead of a string

            Note: 0 is handled specially by this function, so it calls for the entire match,
                even if 0 doesn't mean the entire match in your dialect.

            There's a few of advantages to using this instead of just the regular regex replacement syntax:
            - It's consistent between dialects
            - It's closer to Python f-string syntax, which is cleaner and more familiar
            - It handles numbered, named, and entire replacement types the same