Skip to content

Regex

Pattern matching: match, extract, replace, split, and test.

5 modules

ModuleDescription
正規表現抽出テキストから名前付きグループを抽出する
正規表現マッチテキスト内のパターンのすべての一致を見つける
正規表現置換テキスト内のパターン一致を置換する
正規表現分割正規表現パターンでテキストを分割する
正規表現テスト文字列が正規表現パターンに一致するかテスト

Modules

正規表現抽出

regex.extract

テキストから名前付きグループを抽出する

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-抽出するテキスト
patternstringYes-抽出するテキスト
ignore_casebooleanNoFalse大文字小文字を区別しないマッチング

Output:

FieldTypeDescription
extractedobject大文字小文字を区別しないマッチング
matchedboolean抽出された名前付きグループ
full_matchstring抽出された名前付きグループ

正規表現マッチ

regex.match

テキスト内のパターンのすべての一致を見つける

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-検索するテキスト
patternstringYes-検索するテキスト
ignore_casebooleanNoFalse正規表現パターン
first_onlybooleanNoFalse大文字小文字を区別しないマッチング

Output:

FieldTypeDescription
matchesarray最初の一致のみを返す
countnumber一致のリスト
groupsarray一致のリスト

正規表現置換

regex.replace

テキスト内のパターン一致を置換する

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-処理するテキスト
patternstringYes-処理するテキスト
replacementstringYes-正規表現パターン
ignore_casebooleanNoFalse置換テキスト(後方参照をサポート)
countnumberNo0大文字小文字を区別しないマッチング

Output:

FieldTypeDescription
resultstring最大置換数(0 = 無制限)
replacementsnumber置換後のテキスト
originalstring置換後のテキスト

正規表現分割

regex.split

正規表現パターンでテキストを分割する

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-分割するテキスト
patternstringYes-分割するテキスト
ignore_casebooleanNoFalse区切り用の正規表現パターン
max_splitnumberNo0大文字小文字を区別しないマッチング
remove_emptybooleanNoFalse最大分割数(0 = 無制限)

Output:

FieldTypeDescription
resultarray結果から空の文字列を削除する
countnumber分割された部分

正規表現テスト

regex.test

文字列が正規表現パターンに一致するかテスト

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-テストするテキスト
patternstringYes-テストするテキスト
ignore_casebooleanNoFalse正規表現パターン
full_matchbooleanNoFalse大文字小文字を区別しない一致

Output:

FieldTypeDescription
resultbooleanパターンが文字列全体に一致する必要がある
patternstringパターンが一致するかどうか

Released under the Apache 2.0 License.