regex (4)
re_escape¶
re_escape(string: str, re_type: Literal['python', 'posix_basic'] = 'python') -> str
Escape all regular expressions special characters from STRING.
DocStrings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
The string to escape |
required |
re_type
|
Literal['python', 'posix_basic']
|
The escape type |
'python'
|
Source code in src/jinjarope/regexfilters.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
re_findall¶
re_findall(value: str, regex: str, *, ignorecase: bool = False, multiline: bool = False) -> list[typing.Any]
Perform re.findall and return the list of matches.
DocStrings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
str
|
The text to search in |
required |
regex
|
str
|
The regex to use for searching |
required |
ignorecase
|
bool
|
Whether char casing should be ignored |
False
|
multiline
|
bool
|
Whether to perform a multi-line search |
False
|
Source code in src/jinjarope/regexfilters.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
re_replace¶
re_replace(value: str = '', pattern: str = '', replacement: str = '', *, ignorecase: bool = False, multiline: bool = False, count: int = 0) -> str
Perform a re.sub
returning a string.
DocStrings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
str
|
The value to search-replace. |
''
|
pattern
|
str
|
The regex pattern to use |
''
|
replacement
|
str
|
The replacement pattern to use |
''
|
ignorecase
|
bool
|
Whether to ignore casing |
False
|
multiline
|
bool
|
Whether to do a multiline regex search |
False
|
count
|
int
|
Amount of maximum substitutes. |
0
|
Source code in src/jinjarope/regexfilters.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
re_search¶
re_search(value: str, regex: str, *args: str, ignorecase: bool = False, multiline: bool = False) -> list[str] | None | str
Perform re.search and return the list of matches or a backref.
DocStrings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
str
|
The text to search in |
required |
regex
|
str
|
The regex to use for searching |
required |
args
|
str
|
Optional back references to return |
()
|
ignorecase
|
bool
|
Whether char casing should be ignored |
False
|
multiline
|
bool
|
Whether to perform a multi-line search |
False
|
Source code in src/jinjarope/regexfilters.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|