Returns a string with some or all matches of a pattern replaced. Args: regex: The regular expression to match. replacement: The string that replaces the matched substring. flags: A string specifying a combination of regular expression flags, specifically one or more of
(
self,
regex: _arg_types.String,
replacement: _arg_types.String,
flags: _arg_types.String | None = None,
)
| 172 | ) |
| 173 | |
| 174 | def replace( |
| 175 | self, |
| 176 | regex: _arg_types.String, |
| 177 | replacement: _arg_types.String, |
| 178 | flags: _arg_types.String | None = None, |
| 179 | ) -> String: |
| 180 | """Returns a string with some or all matches of a pattern replaced. |
| 181 | |
| 182 | Args: |
| 183 | regex: The regular expression to match. |
| 184 | replacement: The string that replaces the matched substring. |
| 185 | flags: A string specifying a combination of regular expression flags, |
| 186 | specifically one or more of: 'g' (global match) or 'i' (ignore case). |
| 187 | |
| 188 | Returns: |
| 189 | A string with the replacements. |
| 190 | """ |
| 191 | |
| 192 | return apifunction.ApiFunction.call_( |
| 193 | f'{self.name()}.replace', self, regex, replacement, flags |
| 194 | ) |
| 195 | |
| 196 | def rindex(self, pattern: _arg_types.String) -> ee_number.Number: |
| 197 | """Searches a string for the last occurrence of a substring. |