ヘルプ センターヘルプ センター
テキストの先頭または末尾に一致する
R2020b 以降
pat = textBoundary
pat = textBoundary(type)
例
pat= textBoundaryは、テキストの先頭または末尾に一致するパターンを作成します。textBoundaryは、~演算子を使用して否定できます。否定した場合、textBoundaryは、テキストの先頭または末尾以外のすべての文字に一致します。
pat= textBoundary
pat
textBoundary
~
pat= textBoundary(type)は、テキストの先頭と末尾のどちらに一致させるかを指定します。typeは、'start'、'end'、'either'(既定値) のいずれかです。
pat= textBoundary(type)
type
'start'
'end'
'either'
すべて折りたたむ
textBoundaryを使用して、テキストの先頭または末尾に一致させます。
複数のテキストを含む string 配列を作成します。各テキストの先頭にある単語に一致するパターンを作成します。
txts = ["This is the first piece of text""Here is the second"“现在的re are three"];pat = textBoundary + lettersPattern;
パターンを抽出します。
firstWords = extract(txts,pat)
firstWords =3x1 string"This" "Here" "Now"
textBoundaryで"end"オプションを使用して、テキストの指定した終点に一致させます。
"end"
複数のテキストを含む string 配列を作成します。各テキストの末尾にある単語に一致するパターンを作成します。
txts = ["This is the first piece of text""Here is the second"“现在的re are three"];帕特= lettersPattern + textBoundary ("end");
lastWords = extract(txts,pat)
lastWords =3x1 string"text" "second" "three"
~演算子を使用して、textBoundaryを否定します。これは、2 つの文字がどちらもテキストの先頭または末尾でない場合に、その 2 つの文字の間にある境界に一致します。
複数のテキストを含む string 配列を作成します。テキストの先頭でなく、末尾でもない文字に一致するパターンを作成します。
txts = ["This text is first""Here is the second"“现在的re are three"];pat = ~textBoundary + lettersPattern + ~textBoundary;
lastWords =3x4 string"his" "text" "is" "firs" "ere" "is" "the" "secon" "ow" "there" "are" "thre"
境界タイプ。'start'、'end'または'either'として指定します。
データ型:char|string
char
string
パターン式。patternオブジェクトとして返されます。
pattern
R2020b で導入
pattern|contains|extract|split|lineBoundary|lookAheadBoundary|lookBehindBoundary
contains
extract
split
lineBoundary
lookAheadBoundary
lookBehindBoundary
この例の変更されたバージョンがあります。編集された方の例を開きますか?
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office