mindspore/docs/api/api_python/dataset_text/mindspore.dataset.text.Rege...

21 lines
947 B
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.dataset.text.RegexReplace
===================================
.. py:class:: mindspore.dataset.text.RegexReplace(pattern, replace, replace_all=True)
根据正则表达式对UTF-8编码格式的字符串内容进行正则替换。
有关支持的正则表达式的模式,请参阅 https://unicode-org.github.io/icu/userguide/strings/regexp.html。
.. note:: Windows平台尚不支持 `RegexReplace`
参数:
- **pattern** (str) - 正则表达式的模式。
- **replace** (str) - 替换匹配元素的字符串。
- **replace_all** (bool, 可选) - 如果为False只替换第一个匹配的元素如果为True则替换所有匹配的元素。默认值True。
异常:
- **TypeError** - 参数 `pattern` 的类型不是str。
- **TypeError** - 参数 `replace` 的类型不是str。
- **TypeError** - 参数 `replace_all` 的类型不是bool。