จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: Regexแทนที่
#include <string_ops.h>
แทนที่การจับคู่ของนิพจน์ทั่วไปของ pattern
แบบใน input
ด้วยสตริงการแทนที่ที่ให้ไว้ใน rewrite
สรุป
มันเป็นไปตามไวยากรณ์ re2 ( https://github.com/google/re2/wiki/Syntax )
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- input: ข้อความที่จะประมวลผล
- รูปแบบ: นิพจน์ทั่วไปที่จะจับคู่ในสตริง
input
- เขียนใหม่: สตริงการเขียนใหม่ที่จะแทนที่สำหรับนิพจน์
pattern
ที่ตรงกับสตริง input
แอ็ตทริบิวต์ทางเลือก (ดู Attrs
):
- replacement_global: หากเป็น True การแทนที่จะเป็นแบบโกลบอล (นั่นคือ การจับคู่ทั้งหมดของนิพจน์ทั่วไปของ
pattern
ในสตริงอินพุตแต่ละรายการจะถูกเขียนใหม่) มิฉะนั้น การแทนที่ rewrite
จะทำสำหรับการจับคู่ pattern
แบบแรกเท่านั้น
ผลตอบแทน:
-
Output
: ข้อความหลังจากใช้การจับคู่รูปแบบและเขียนการทดแทนใหม่
คุณลักษณะสาธารณะ
งานสาธารณะ
โหนด
::tensorflow::Node * node() const
operator::tensorflow::Input() const
ตัวดำเนินการ::tensorflow::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
แทนที่โกลบอล
Attrs ReplaceGlobal(
bool x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::RegexReplace Class Reference\n\ntensorflow::ops::RegexReplace\n=============================\n\n`#include \u003cstring_ops.h\u003e`\n\nReplaces matches of the `pattern` regular expression in `input` with the replacement string provided in `rewrite`.\n\nSummary\n-------\n\nIt follows the re2 syntax (\u003chttps://github.com/google/re2/wiki/Syntax\u003e)\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: The text to be processed.\n- pattern: The regular expression to be matched in the `input` strings.\n- rewrite: The rewrite string to be substituted for the `pattern` expression where it is matched in the `input` strings.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/regex-replace/attrs#structtensorflow_1_1ops_1_1_regex_replace_1_1_attrs)):\n\n- replace_global: If True, the replacement is global (that is, all matches of the `pattern` regular expression in each input string are rewritten), otherwise the `rewrite` substitution is only made for the first `pattern` match.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): The text after applying pattern match and rewrite substitution.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [RegexReplace](#classtensorflow_1_1ops_1_1_regex_replace_1a476950575052dd378f93320dfb8abeac)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` pattern, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` rewrite)` ||\n| [RegexReplace](#classtensorflow_1_1ops_1_1_regex_replace_1a789bb5399331382a4344de266971b9a1)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` pattern, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` rewrite, const `[RegexReplace::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/regex-replace/attrs#structtensorflow_1_1ops_1_1_regex_replace_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_regex_replace_1a7dda8b284f9da03cdb8789215ce49f6e) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_regex_replace_1a5aaa612bfbbe1062fb3a7edba850dc08) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_regex_replace_1af7c8b0135952cc634c3d1eeae9d7e037)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_regex_replace_1a0278c9b0f91ce7ea1ce36d07d960c0f8)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_regex_replace_1aadbcd5dc87a024bfd055536f882464bd)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|---------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n| [ReplaceGlobal](#classtensorflow_1_1ops_1_1_regex_replace_1a5a363e91c2910ff82c7ed8ea2454f7de)`(bool x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/regex-replace/attrs#structtensorflow_1_1ops_1_1_regex_replace_1_1_attrs) |\n\n| ### Structs ||\n|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::RegexReplace::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/regex-replace/attrs) | Optional attribute setters for [RegexReplace](/versions/r2.3/api_docs/cc/class/tensorflow/ops/regex-replace#classtensorflow_1_1ops_1_1_regex_replace). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### RegexReplace\n\n```gdscript\n RegexReplace(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input pattern,\n ::tensorflow::Input rewrite\n)\n``` \n\n### RegexReplace\n\n```gdscript\n RegexReplace(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input pattern,\n ::tensorflow::Input rewrite,\n const RegexReplace::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### ReplaceGlobal\n\n```text\nAttrs ReplaceGlobal(\n bool x\n)\n```"]]