regex

Post on 19-Jun-2015

429 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

正規表現

正規表現

正規表現

あらゆるパターンを列挙せずに文字列群を簡潔に表現

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode

http://shapecatcher.com/unicode/block/Katakana.html

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F834 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク グ835 ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ ダ836 チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ バ837 パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ838 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ839 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Shift_JIS

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode

http://shapecatcher.com/unicode/block/Katakana.html

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode KATAKANA-HIRAGANA DOUBLE HYPHEN

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode KATAKANA MIDDLE DOT

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode KATAKANA-HIRAGANA PROLONGED SOUND MARK

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode KATAKANA ITERATION MARK

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode KATAKANA VOICED ITERATION MARK

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode KATAKANA DIGRAPH KOTO

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

0 1 2 3 4 5 6 7 8 9 A B C D E F30A0 ゠ ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ ヿ

Unicode

1文字ずつコードを比較していたら大変・・・

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

$regex:="[\\u30A0-\\u30FF]+"

$yomi:="ミヤコケイスケ"

$match:=Match regex($regex;$yomi)

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

$regex:="[\\u30A0-\\u30FF]+"

$yomi:="ミヤコケイスケ"

$match:=Match regex($regex;$yomi)

文字コードが合致

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

$regex:="[\\u30A0-\\u30FF]+"

$yomi:="ミヤコケイスケ"

$match:=Match regex($regex;$yomi)

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

$regex:="[:Katakana:]+"

$yomi:="ミヤコケイスケ"

$match:=Match regex($regex;$yomi)

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

$regex:="[:Katakana:]+"

$yomi:="ミヤコケイスケ"

$match:=Match regex($regex;$yomi)

プロパティが合致

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

カタカナEx. 1

$regex:="[:Katakana:]+"

$yomi:="ミヤコケイスケ"

$match:=Match regex($regex;$yomi)

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

半角カタカナEx. 2

$regex:="[:East Asian Width=Halfwidth:]+"

$yomi:="ミヤコケイスケ"

$match:=Match regex($regex;$yomi)

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

漢字Ex. 3

$regex:="[:Ideographic:]+"

$name:="宮古啓介"

$match:=Match regex($regex;$name)

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

英数Ex. 4

$regex:="[:East Asian Width=Narrow:]+"

$user:="miyako0922"ス

$match:=Match regex($regex;$user)

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

電子メールアドレスEx. 5

正規表現あらゆるパターンを列挙せずに文字列群を簡潔に表現

http://www.w3.org/TR/html5-author/states-of-the-type-attribute.html#e-mail-state-(type=email)

電子メールアドレスEx. 5

$regex:="^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+\ @[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$"

$address:="keisuke.miyako@4d.com"ス

$match:=Match regex($regex;$address)

正規表現

正規表現使用する理由

正規表現

一般

使用する理由

正規表現

‣文字列処理の標準ツール(構文・ライブラリで提供)一般

使用する理由

正規表現

‣文字列処理の標準ツール(構文・ライブラリで提供)‣既存のソリューションが豊富

一般

使用する理由

正規表現

‣文字列処理の標準ツール(構文・ライブラリで提供)‣既存のソリューションが豊富

一般

4D

使用する理由

正規表現

‣文字列処理の標準ツール(構文・ライブラリで提供)‣既存のソリューションが豊富

‣包括的( c.f. Character code)

一般

4D

使用する理由

正規表現

‣文字列処理の標準ツール(構文・ライブラリで提供)‣既存のソリューションが豊富

‣包括的( c.f. Character code)

‣厳格(c.f. Position,=,#)

一般

4D

使用する理由

Match regex

Match regex構文

Match regex構文

1/7

Match regex構文

1/7

C_TEXT($regex;$string)C_BOOLEAN($match)

$match:=Match regex($regex;$string)

Match regex構文

1/7

C_TEXT($regex;$string)C_BOOLEAN($match)

$match:=Match regex($regex;$string)

$stringが$regexにピッタリ合致すればTrue

Match regex構文

2/7

Match regex構文

2/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)

$match:=Match regex($regex;$string;$start)

Match regex構文

2/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)

$match:=Match regex($regex;$string;$start)

$stringが$regexに$start以降で合致すればTrue

Match regex構文

3/7

Match regex構文

3/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)

$match:=Match regex($regex;$string;$start;*)

Match regex構文

3/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)

$match:=Match regex($regex;$string;$start;*)

$stringが$regexに$startでピッタリ合致すればTrue

Match regex構文

4/7

Match regex構文

4/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start;$pos;$len)

$match:=Match regex($regex;$string;$start;$pos;$len)

Match regex構文

4/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start;$pos;$len)

$match:=Match regex($regex;$string;$start;$pos;$len)

$stringが$regexに$start以降で合致すればTrue

Match regex構文

4/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start;$pos;$len)

$match:=Match regex($regex;$string;$start;$pos;$len)

$len: 合致した文字数

$pos: 合致した位置

$stringが$regexに$start以降で合致すればTrue

Match regex構文

5/7

Match regex構文

5/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start;$pos;$len)

$match:=Match regex($regex;$string;$start;$pos;$len;*)

Match regex構文

5/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start;$pos;$len)

$match:=Match regex($regex;$string;$start;$pos;$len;*)

$stringが$regexに$startでピッタリ合致すればTrue

Match regex構文

5/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start;$pos;$len)

$match:=Match regex($regex;$string;$start;$pos;$len;*)

$len: 合致した文字数

$pos: 合致した位置

$stringが$regexに$startでピッタリ合致すればTrue

Match regex構文

6/7

Match regex構文

6/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)

$match:=Match regex($regex;$string;$start;$pos;$len)

Match regex構文

6/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)

$match:=Match regex($regex;$string;$start;$pos;$len)

$stringが$regexに$start以降で合致すればTrue

Match regex構文

6/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)

$match:=Match regex($regex;$string;$start;$pos;$len)

$stringが$regexに$start以降で合致すればTrue

$len: グループ毎の合致した文字数

$pos: グループ毎の合致した位置

Match regex構文

7/7

Match regex構文

7/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)

$match:=Match regex($regex;$string;$start;$pos;$len;*)

Match regex構文

7/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)

$match:=Match regex($regex;$string;$start;$pos;$len;*)

$stringが$regexに$startでピッタリ合致すればTrue

Match regex構文

7/7

C_TEXT($regex;$string)C_BOOLEAN($match)C_LONGINT($start)ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)

$match:=Match regex($regex;$string;$start;$pos;$len;*)

$stringが$regexに$startでピッタリ合致すればTrue

$len: グループ毎の合致した文字数

$pos: グループ毎の合致した位置

正規表現

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

\A 入力の始まり \d 数字 \x 文字を2桁16進で指定\z 入力の終わり \D 数字ではない \u 文字を4桁16進で指定

\Z 入力の終わり* \p プロパティ有 \U 文字を8桁16進で指定

\b ワードの区切り \P プロパティ無 \0 文字を3桁で8進で指定

\B ワードの区切りではない \s 空白 \N 文字を名前で指定

\a ベル(U+0007) \S 空白ではない \1 捕捉したグループの参照

\t TAB(U+0009) \w ワード文字 \G パターンの後わり\e ESC(U+001B) \W ワード文字ではない . 文字\r CR(U+000D) \Q エスケープシーケンス始 ^ 行の始まり\f FF(U+000C) \E エスケープシーケンス終 $ 行の終わり\n LF(U+000A) \X グラフィームクラスター \ 後続の文字をエスケープ

*端末文字は含まない

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

\A 入力の始まり \d 数字 \x 文字を2桁16進で指定\z 入力の終わり \D 数字ではない \u 文字を4桁16進で指定

\Z 入力の終わり* \p プロパティ有 \U 文字を8桁16進で指定

\b ワードの区切り \P プロパティ無 \0 文字を3桁で8進で指定

\B ワードの区切りではない \s 空白 \N 文字を名前で指定

\a ベル(U+0007) \S 空白ではない \1 捕捉したグループの参照

\t TAB(U+0009) \w ワード文字 \G パターンの後わり\e ESC(U+001B) \W ワード文字ではない . 文字\r CR(U+000D) \Q エスケープシーケンス始 ^ 行の始まり\f FF(U+000C) \E エスケープシーケンス終 $ 行の終わり\n LF(U+000A) \X グラフィームクラスター \ 後続の文字をエスケープ

*端末文字は含まない

basic

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

\A 入力の始まり \d 数字 \x 文字を2桁16進で指定\z 入力の終わり \D 数字ではない \u 文字を4桁16進で指定

\Z 入力の終わり* \p プロパティ有 \U 文字を8桁16進で指定

\b ワードの区切り \P プロパティ無 \0 文字を3桁で8進で指定

\B ワードの区切りではない \s 空白 \N 文字を名前で指定

\a ベル(U+0007) \S 空白ではない \1 捕捉したグループの参照

\t TAB(U+0009) \w ワード文字 \G パターンの後わり\e ESC(U+001B) \W ワード文字ではない . 文字\r CR(U+000D) \Q エスケープシーケンス始 ^ 行の始まり\f FF(U+000C) \E エスケープシーケンス終 $ 行の終わり\n LF(U+000A) \X グラフィームクラスター \ 後続の文字をエスケープ

*端末文字は含まない

advanced

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

. 文字

$regex:="Column."$string:="ColumnA"$match:=Match regex($regex;$string)

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

True

. 文字

$regex:="Column."$string:="ColumnA"$match:=Match regex($regex;$string)

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\d"$string:="Column2"$match:=Match regex($regex;$string)

\d 数字

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\d"$string:="Column2"$match:=Match regex($regex;$string)

True

\d 数字

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d"$string:="Column1"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

\d 数字

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d"$string:="Column1"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

\d 数字

True

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d"$string:="Column1"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

1

\d 数字

True

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\s\\d"$string:="Column 2"$match:=Match regex($regex;$string)

\s 空白

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\s\\d"$string:="Column 2"$match:=Match regex($regex;$string)

True

\s 空白

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\s\\d"$string:="Column 2"$match:=Match regex($regex;$string)

True

\s 空白

\s: [\t\n\f\r\p{Z}] 全角スペース タブ 改行 その他 [:Separator:]

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\u0001"$string:="Column"+Char(1)$match:=Match regex($regex;$string)

\u 文字を4桁16進で指定

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\u0001"$string:="Column"+Char(1)$match:=Match regex($regex;$string)

True

\u 文字を4桁16進で指定

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="^Column\\d"$string:=" Column1"$match:=Match regex($regex;$string;1)

^ 行の始まり

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="^Column\\d"$string:=" Column1"$match:=Match regex($regex;$string;1)

False

^ 行の始まり

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\d$"$string:="Column1 "$match:=Match regex($regex;$string;1)

$ 行の終わり

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\d$"$string:="Column1 "$match:=Match regex($regex;$string;1)

False

$ 行の終わり

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\d\\.\\d"$string:="Column1.2"$match:=Match regex($regex;$string;1)

\ 後続の文字をエスケープ

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\d\\.\\d"$string:="Column1.2"$match:=Match regex($regex;$string;1)

\ 後続の文字をエスケープ

エスケープが必要な文字: * ? + [ ( ) { } ^ $ | \ .

正規表現メタ文字

http://userguide.icu-project.org/strings/regexp

basic

$regex:="Column\\d\\.\\d"$string:="Column1.2"$match:=Match regex($regex;$string;1)

\ 後続の文字をエスケープ

エスケープが必要な文字: * ? + [ ( ) { } ^ $ | \ .

True

正規表現

正規表現演算子

http://userguide.icu-project.org/strings/regexp

正規表現演算子

http://userguide.icu-project.org/strings/regexp

| パターンの論理和【OR】 {n} n個ピッタリ

* 0個以上,できるだけ多く【控えめ】 {n,} n個以上,できるだけ多く【控えめ】

+ 1個以上,できるだけ多く【控えめ】 {n,m} n個以上,m個以下,できるだけ多く【控えめ】

*+ 0個以上,できるだけ多く【欲張り】 {n,} n個以上,できるだけ多く【欲張り】

++ 1個以上,できるだけ多く【欲張り】 {n,m} n個以上,m個以下,できるだけ多く【 欲張り】

*? 0個以上,できるだけ少なく (...) 捕捉するグループ

+? 1個以上,できるだけ少なく (?:...) 捕捉しないグループ

? 1個以下,できれば1個【控えめ】 (?=...) 先読みアサーション

?+ 1個以下,できれば1個【欲張り】 (?!...) 否定先読みアサーション

?? 1個以下,できれば0個 (?<=...) 後読みアサーション

(?#...) コメント (?<!...) 否定後読みアサーション

正規表現演算子

http://userguide.icu-project.org/strings/regexp

| パターンの論理和【OR】 {n} n個ピッタリ

* 0個以上,できるだけ多く【控えめ】 {n,} n個以上,できるだけ多く【控えめ】

+ 1個以上,できるだけ多く【控えめ】 {n,m} n個以上,m個以下,できるだけ多く【控えめ】

*+ 0個以上,できるだけ多く【欲張り】 {n,} n個以上,できるだけ多く【欲張り】

++ 1個以上,できるだけ多く【欲張り】 {n,m} n個以上,m個以下,できるだけ多く【 欲張り】

*? 0個以上,できるだけ少なく (...) 捕捉するグループ

+? 1個以上,できるだけ少なく (?:...) 捕捉しないグループ

? 1個以下,できれば1個【控えめ】 (?=...) 先読みアサーション

?+ 1個以下,できれば1個【欲張り】 (?!...) 否定先読みアサーション

?? 1個以下,できれば0個 (?<=...) 後読みアサーション

(?#...) コメント (?<!...) 否定後読みアサーション

basic

正規表現演算子

http://userguide.icu-project.org/strings/regexp

| パターンの論理和【OR】 {n} n個ピッタリ

* 0個以上,できるだけ多く【控えめ】 {n,} n個以上,できるだけ多く【控えめ】

+ 1個以上,できるだけ多く【控えめ】 {n,m} n個以上,m個以下,できるだけ多く【控えめ】

*+ 0個以上,できるだけ多く【欲張り】 {n,} n個以上,できるだけ多く【欲張り】

++ 1個以上,できるだけ多く【欲張り】 {n,m} n個以上,m個以下,できるだけ多く【 欲張り】

*? 0個以上,できるだけ少なく (...) 捕捉するグループ

+? 1個以上,できるだけ少なく (?:...) 捕捉しないグループ

? 1個以下,できれば1個【控えめ】 (?=...) 先読みアサーション

?+ 1個以下,できれば1個【欲張り】 (?!...) 否定先読みアサーション

?? 1個以下,できれば0個 (?<=...) 後読みアサーション

(?#...) コメント (?<!...) 否定後読みアサーション

advanced

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d+"$string:="123"$match:=Match regex($regex;$string)

演算子+ 1個以上,できるだけ多く【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d+"$string:="123"$match:=Match regex($regex;$string)

演算子+ 1個以上,できるだけ多く【控えめ】

True

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d+"$string:="-123"$match:=Match regex($regex;$string)

演算子+ 1個以上,できるだけ多く【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d+"$string:="-123"$match:=Match regex($regex;$string)

演算子

False

+ 1個以上,できるだけ多く【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="-?\\d+"$string:="-123"$match:=Match regex($regex;$string)

演算子? 1個以下,できれば1個【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="-?\\d+"$string:="-123"$match:=Match regex($regex;$string)

True

演算子? 1個以下,できれば1個【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="-|\\+\\d+"$string:="+123"$match:=Match regex($regex;$string)

演算子| パターンの論理和【OR】

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="-|\\+\\d+"$string:="+123"$match:=Match regex($regex;$string)

True

演算子| パターンの論理和【OR】

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="-?(?:\\d|,)+"$string:="-123,456"$match:=Match regex($regex;$string)

演算子(?:...) 捕捉しないグループ

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="-?(?:\\d|,)+"$string:="-123,456"$match:=Match regex($regex;$string)

True

演算子(?:...) 捕捉しないグループ

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="ID-\\d{6}"$string:="ID-123456"$match:=Match regex($regex;$string)

演算子{n} n個ピッタリ

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="ID-\\d{6}"$string:="ID-123456"$match:=Match regex($regex;$string)

True

演算子{n} n個ピッタリ

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d{4}-\\d{1,2}-\\d{1,2}"$string:="2013-1-13"$match:=Match regex($regex;$string)

演算子{n,m} n個以上,m個以下,できるだけ多く【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic

$regex:="\\d{4}-\\d{1,2}-\\d{1,2}"$string:="2013-1-13"$match:=Match regex($regex;$string)

True

演算子{n,m} n個以上,m個以下,できるだけ多く【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子* 0個以上,できるだけ多く【控えめ】

$regex:="Column\\d*"$string:="Column12345"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子* 0個以上,できるだけ多く【控えめ】

$regex:="Column\\d*"$string:="Column12345"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

True

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子* 0個以上,できるだけ多く【控えめ】

$regex:="Column\\d*"$string:="Column12345"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

Column12345True

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子

$regex:=".+?:\\d+,??"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

+? 1個以上,できるだけ少なく【控えめ】

?? 1個以下,できれば0個【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子

$regex:=".+?:\\d+,??"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

+? 1個以上,できるだけ少なく【控えめ】

?? 1個以下,できれば0個【控えめ】

True

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子

$regex:=".+?:\\d+,??"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

tea:10

+? 1個以上,できるだけ少なく【控えめ】

?? 1個以下,できれば0個【控えめ】

True

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子

$regex:=".+:\\d+,?"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

+ 1個以上,できるだけ多く【控えめ】

? 1個以下,できれば1個【控えめ】

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子

$regex:=".+:\\d+,?"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

+ 1個以上,できるだけ多く【控えめ】

? 1個以下,できれば1個【控えめ】

True

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子

$regex:=".+:\\d+,?"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

tea:10,coffee:4

+ 1個以上,できるだけ多く【控えめ】

? 1個以下,できれば1個【控えめ】

True

正規表現

http://userguide.icu-project.org/strings/regexp

basic演算子

$regex:=".+:\\d+,?"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

tea:10,coffee:4

+ 1個以上,できるだけ多く【控えめ】

? 1個以下,できれば1個【控えめ】

控えめ: 全体がマッチするのであれば最大数以下で満足する(数を減らして再評価)

True

正規表現

http://userguide.icu-project.org/strings/regexp

演算子

$regex:=".++:\\d+,?+"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

advanced

+ + 1個以上,できるだけ多く【欲張り】

?+ 1個以下,できれば1個【欲張り】

正規表現

http://userguide.icu-project.org/strings/regexp

演算子

$regex:=".++:\\d+,?+"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

advanced

+ + 1個以上,できるだけ多く【欲張り】

?+ 1個以下,できれば1個【欲張り】

False

正規表現

http://userguide.icu-project.org/strings/regexp

演算子

$regex:=".++:\\d+,?+"$string:="tea:10,coffee:4"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

advanced

+ + 1個以上,できるだけ多く【欲張り】

?+ 1個以下,できれば1個【欲張り】

False

欲張り: 数を減らすことで全体がマッチするとしても取ったものは手放さない

正規表現

正規表現グループ

http://userguide.icu-project.org/strings/regexp

正規表現グループ

http://userguide.icu-project.org/strings/regexp

ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)$regex:="(^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+)\ @([a-zA-Z0-9-]+)(\\.[a-zA-Z0-9-]+)*$"$string:="keisuke.miyako@4d.com"$match:=Match regex($regex;$string;1;$pos;$len)$group1:=Substring($string;$pos{1};$len{1})$group2:=Substring($string;$pos{2};$len{2})$group3:=Substring($string;$pos{3};$len{3})

正規表現グループ

http://userguide.icu-project.org/strings/regexp

ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)$regex:="(^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+)\ @([a-zA-Z0-9-]+)(\\.[a-zA-Z0-9-]+)*$"$string:="keisuke.miyako@4d.com"$match:=Match regex($regex;$string;1;$pos;$len)$group1:=Substring($string;$pos{1};$len{1})$group2:=Substring($string;$pos{2};$len{2})$group3:=Substring($string;$pos{3};$len{3})

配列の要素数は捕捉グループ数に対応する

正規表現グループ

http://userguide.icu-project.org/strings/regexp

ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)$regex:="(^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+)\ @([a-zA-Z0-9-]+)(\\.[a-zA-Z0-9-]+)*$"$string:="keisuke.miyako@4d.com"$match:=Match regex($regex;$string;1;$pos;$len)$group1:=Substring($string;$pos{1};$len{1})$group2:=Substring($string;$pos{2};$len{2})$group3:=Substring($string;$pos{3};$len{3})

配列の要素数は捕捉グループ数に対応する位置とサイズはそのままSubstringに渡すことができる

正規表現グループ

http://userguide.icu-project.org/strings/regexp

ARRAY LONGINT($pos;0)ARRAY LONGINT($len;0)$regex:="(^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+)\ @([a-zA-Z0-9-]+)(\\.[a-zA-Z0-9-]+)*$"$string:="keisuke.miyako@4d.com"$match:=Match regex($regex;$string;1;$pos;$len)$group1:=Substring($string;$pos{1};$len{1})$group2:=Substring($string;$pos{2};$len{2})$group3:=Substring($string;$pos{3};$len{3})$group1 keisuke.miyako

$group2 4d

$group3 .com

配列の要素数は捕捉グループ数に対応する位置とサイズはそのままSubstringに渡すことができる

正規表現

正規表現セット

http://userguide.icu-project.org/strings/regexp

正規表現セット

http://userguide.icu-project.org/strings/regexp

[BC] 列挙した文字のどれかに合致[^BC] 列挙した文字でなければ合致[B-D] 指定した範囲内の文字に合致(コードポイント順)

[:Letter:] プロパティで合致【POSIX表記】[\p{Letter}] プロパティで合致【Perl表記】

[\p{L}] プロパティで合致【Perl表記・短縮形】[\p{property=value}] プロパティと値で合致

[[:...:][:...:]] セットの集合結合【UNION】[[:...:]-[:...:]] セットの集合差異【DIFFERENCE】[[:...:]&[:...:]] セットの集合交差【INTERSECTION】[\\u0001] コードポイントに合致

[\\u0001-\\u0020] コードポイントの範囲に合致

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[BC]"$string:="sample.4DB"$match:=Match regex($regex;$string)

[BC] 列挙した文字のどれかに合致

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[^BC]"$string:="sample.4DD"$match:=Match regex($regex;$string)

[^BC] 列挙した文字でなければ合致

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[B-D]"$string:="sample.4DD"$match:=Match regex($regex;$string)

[B-D] 指定した範囲内の文字に合致(コードポイント順)

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[:Letter:]"$string:="sample.4DB"$match:=Match regex($regex;$string)

[:Letter:] プロパティで合致【POSIX表記】

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[\\p{Letter}]"$string:="sample.4DB"$match:=Match regex($regex;$string)

[\p{Letter}] プロパティで合致【Perl表記】

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[\\p{L}]"$string:="sample.4DB"$match:=Match regex($regex;$string)

[\p{L}] プロパティで合致【Perl表記・短縮形】

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:="[\\p{numeric_value=9}]+"$string:="99九Ⅸⅸ⑨⑼⒐❾"$match:=Match regex($regex;$string)

[\p{property=value}] プロパティと値で合致

$regex:="[\\p{numeric_value=9}]+"$string:="abc"+char(9)$match:=Match regex($regex;$string)

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[[:Letter:][:Number:]]"$string:="sample.4DB"$match:=Match regex($regex;$string)

[[:...:][:...:]] セットの集合結合【UNION】

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[[:Letter:]-[:Number:]]"$string:="sample.4DB"$match:=Match regex($regex;$string)

[[:...:]-[:...:]] セットの集合差異【DIFFERENCE】

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[[:Letter:]&[:Uppercase:]]"$string:="sample.4DB"$match:=Match regex($regex;$string)

[[:...:]&[:...:]] セットの集合交差【INTERSECTION】

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+\\.4D[\\p{Lu}]"$string:="sample.4DB"$match:=Match regex($regex;$string)

[\p{Lu}] プロパティで合致【Letter, Uppercase】

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+[\\u0001]"$string:="abc"+char(1)$match:=Match regex($regex;$string)

[\\u0001] コードポイントに合致

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:=".+[\\u0001-\\u0020]"$string:="abc"+char(9)$match:=Match regex($regex;$string)

[\\u0001-\\u0020] コードポイントの範囲に合致

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:="[\\p{numeric_value=9}]+"$string:="ミヤコケイスケ"$match:=Match regex($regex;$string)

$regex:="[:Katakana:]+"$string:="abc"+char(9)$match:=Match regex($regex;$string)

[:Katakana:] プロパティで合致

正規表現セット

http://userguide.icu-project.org/strings/regexp

$regex:="[\\p{numeric_value=9}]+"$string:="ミヤコケイスケ"$match:=Match regex($regex;$string)

$regex:="[:East Asian Width=Halfwidth:]+"$string:="abc"+char(9)$match:=Match regex($regex;$string)

[: property=value:] プロパティと値で合致

正規表現

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

i 【英】大文字と小文字を区別しない

x パターン内のコメントを許可する

s 改行も文字として扱う("."に合致)

m 行単位で入力を処理する("^"に始まり"$"で終わる)

w ワードの区切りに境界解析を使用する("\b"に合致)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

i 【英】大文字と小文字を区別しない

x パターン内のコメントを許可する

s 改行も文字として扱う("."に合致)

m 行単位で入力を処理する("^"に始まり"$"で終わる)

w ワードの区切りに境界解析を使用する("\b"に合致)

正規表現フラグ

i 【英】大文字と小文字を区別しない

定義: Uppercase, Lowercase, Titlecasehttp://unicode.org/faq/casemap_charprop.html

ラテン・ギリシャ・キリル・アルメニア文字・一部の古代文字

http://userguide.icu-project.org/strings/regexp

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

i 【英】大文字と小文字を区別しない

$regex:="[^.]+\\.4db"$string:="sample.4DB"$match:=Match regex($regex;$string)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

i 【英】大文字と小文字を区別しない

$regex:="[^.]+\\.4db"$string:="sample.4DB"$match:=Match regex($regex;$string)

False

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

i 【英】大文字と小文字を区別しない

$regex:="(?i)[^.]+\\.4db"$string:="sample.4DB"$match:=Match regex($regex;$string)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

i 【英】大文字と小文字を区別しない

$regex:="(?i)[^.]+\\.4db"$string:="sample.4DB"$match:=Match regex($regex;$string)

True

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

s 改行も文字として扱う("."に合致)

C_LONGINT($pos;$len)$regex:="Content-Length:.+"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

s 改行も文字として扱う("."に合致)

C_LONGINT($pos;$len)$regex:="Content-Length:.+"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

Content-Length:100

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

s 改行も文字として扱う("."に合致)

C_LONGINT($pos;$len)$regex:="(?s)Content-Length:.+"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

s 改行も文字として扱う("."に合致)

C_LONGINT($pos;$len)$regex:="(?s)Content-Length:.+"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1;$pos;$len)$substring:=Substring($string;$pos;$len)

Content-Length:100 Content-Type:application/json

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

m 行単位で入力を処理する("^"に始まり"$"で終わる)

$regex:="^Content-Length:.+$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

m 行単位で入力を処理する("^"に始まり"$"で終わる)

$regex:="^Content-Length:.+$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

False

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

m 行単位で入力を処理する("^"に始まり"$"で終わる)

$regex:="(?m)^Content-Length:.+$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

m 行単位で入力を処理する("^"に始まり"$"で終わる)

$regex:="(?m)^Content-Length:.+$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

True

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="(?mi)^Content-Length:.+$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

m 行単位で入力を処理する("^"に始まり"$"で終わる)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="(?mi)^Content-Length:.+$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

True

m 行単位で入力を処理する("^"に始まり"$"で終わる)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="(?mi)^Content-Length:.+$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

True

m 行単位で入力を処理する("^"に始まり"$"で終わる)

(?mi) フラグの併用

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="(?mi)^Content-Length:.+(?-m)$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

m 行単位で入力を処理する("^"に始まり"$"で終わる)

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="(?mi)^Content-Length:.+(?-m)$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

m 行単位で入力を処理する("^"に始まり"$"で終わる)

(?-m) フラグの取り消し

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="(?mi)^Content-Length:.+(?-m)$"$string:="Content-Length:100\r\n\ Content-Type:application/json"$match:=Match regex($regex;$string;1)

m 行単位で入力を処理する("^"に始まり"$"で終わる)

(?-m) フラグの取り消し

False

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="[^.]+(?i:\\.4db)"$string:="sample.4DB"$match:=Match regex($regex;$string)

i 【英】大文字と小文字を区別しない

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="[^.]+(?i:\\.4db)"$string:="sample.4DB"$match:=Match regex($regex;$string)

i 【英】大文字と小文字を区別しない

True

正規表現フラグ

http://userguide.icu-project.org/strings/regexp

$regex:="[^.]+(?i:\\.4db)"$string:="sample.4DB"$match:=Match regex($regex;$string)

i 【英】大文字と小文字を区別しない

True

(?i:) カッコ内だけで有効なフラグ

正規表現

top related