SlideShare ist ein Scribd-Unternehmen logo
1 von 170
Downloaden Sie, um offline zu lesen
正規表現
正規表現
正規表現
あらゆるパターンを列挙せずに文字列群を簡潔に表現
正規表現
あらゆるパターンを列挙せずに文字列群を簡潔に表現
正規表現
あらゆるパターンを列挙せずに文字列群を簡潔に表現
カタカナEx. 1
正規表現
あらゆるパターンを列挙せずに文字列群を簡潔に表現
カタカナEx. 1
0 1 2 3 4 5 6 7 8 9 A B C D E F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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 F
834 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク グ
835 ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ ダ
836 チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ バ
837 パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ
838 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ
839 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ
Shift_JIS
正規表現
あらゆるパターンを列挙せずに文字列群を簡潔に表現
カタカナEx. 1
0 1 2 3 4 5 6 7 8 9 A B C D E F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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 F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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 F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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 F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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 F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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 F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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 F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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 F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
30B0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ
30C0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ
30D0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ
30E0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ
30F0 ヰ ヱ ヲ ン ヴ ヵ ヶ ヷ ヸ ヹ ヺ ・ ー ヽ ヾ
Unicode
正規表現
あらゆるパターンを列挙せずに文字列群を簡潔に表現
カタカナEx. 1
0 1 2 3 4 5 6 7 8 9 A B C D E F
30A0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
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:="Columnd"
$string:="Column2"
$match:=Match regex($regex;$string)
d 数字
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnd"
$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:="Columnsd"
$string:="Column 2"
$match:=Match regex($regex;$string)
s 空白
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnsd"
$string:="Column 2"
$match:=Match regex($regex;$string)
True
s 空白
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnsd"
$string:="Column 2"
$match:=Match regex($regex;$string)
True
s 空白
s: [tnfrp{Z}] 全角スペース タブ 改行 その他 [:Separator:]
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnu0001"
$string:="Column"+Char(1)
$match:=Match regex($regex;$string)
u 文字を4桁16進で指定
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnu0001"
$string:="Column"+Char(1)
$match:=Match regex($regex;$string)
True
u 文字を4桁16進で指定
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="^Columnd"
$string:=" Column1"
$match:=Match regex($regex;$string;1)
^ 行の始まり
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="^Columnd"
$string:=" Column1"
$match:=Match regex($regex;$string;1)
False
^ 行の始まり
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnd$"
$string:="Column1 "
$match:=Match regex($regex;$string;1)
$ 行の終わり
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnd$"
$string:="Column1 "
$match:=Match regex($regex;$string;1)
False
$ 行の終わり
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnd.d"
$string:="Column1.2"
$match:=Match regex($regex;$string;1)
 後続の文字をエスケープ
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnd.d"
$string:="Column1.2"
$match:=Match regex($regex;$string;1)
 後続の文字をエスケープ
エスケープが必要な文字: * ? + [ ( ) { } ^ $ |  .
正規表現
メタ文字
http://userguide.icu-project.org/strings/regexp
basic
$regex:="Columnd.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:="Columnd*"
$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:="Columnd*"
$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:="Columnd*"
$string:="Column12345"
$match:=Match regex($regex;$string;1;$pos;$len)
$substring:=Substring($string;$pos;$len)
Column12345
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個以下,できれば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, Titlecase
http://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:100rn
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:100rn
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:100rn
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:100rn
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:100rn
Content-Type:application/json"
$match:=Match regex($regex;$string;1)
正規表現
フラグ
http://userguide.icu-project.org/strings/regexp
m 行単位で入力を処理する("^"に始まり"$"で終わる)
$regex:="^Content-Length:.+$"
$string:="Content-Length:100rn
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:100rn
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:100rn
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:100rn
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:100rn
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:100rn
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:100rn
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:100rn
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:100rn
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:) カッコ内だけで有効なフラグ
正規表現

Weitere ähnliche Inhalte

Mehr von kmiyako

Code Optimisation
Code OptimisationCode Optimisation
Code Optimisationkmiyako
 
Auto Update
Auto UpdateAuto Update
Auto Updatekmiyako
 
Classic Query Editor
Classic Query EditorClassic Query Editor
Classic Query Editorkmiyako
 
Web area-phone-home
Web area-phone-homeWeb area-phone-home
Web area-phone-homekmiyako
 
MONET研究会 #14
MONET研究会 #14MONET研究会 #14
MONET研究会 #14kmiyako
 
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~kmiyako
 
Journaling slides
Journaling slidesJournaling slides
Journaling slideskmiyako
 
Unicode-v11-5
Unicode-v11-5Unicode-v11-5
Unicode-v11-5kmiyako
 
Unicode-v11-0
Unicode-v11-0Unicode-v11-0
Unicode-v11-0kmiyako
 
アップグレードセミナー
アップグレードセミナーアップグレードセミナー
アップグレードセミナーkmiyako
 
4D Write Pro
4D Write Pro4D Write Pro
4D Write Prokmiyako
 
バックアップと復元
バックアップと復元バックアップと復元
バックアップと復元kmiyako
 
⽇本語全⽂検索
⽇本語全⽂検索⽇本語全⽂検索
⽇本語全⽂検索kmiyako
 
⾼解像度ディスプレイ
⾼解像度ディスプレイ⾼解像度ディスプレイ
⾼解像度ディスプレイkmiyako
 
ラベルエディター
ラベルエディターラベルエディター
ラベルエディターkmiyako
 
リストフォーム⼤改造
リストフォーム⼤改造リストフォーム⼤改造
リストフォーム⼤改造kmiyako
 
正しいクエリの書き⽅
正しいクエリの書き⽅正しいクエリの書き⽅
正しいクエリの書き⽅kmiyako
 
カスタマイズできる⼊力画面
カスタマイズできる⼊力画面カスタマイズできる⼊力画面
カスタマイズできる⼊力画面kmiyako
 

Mehr von kmiyako (20)

Code Optimisation
Code OptimisationCode Optimisation
Code Optimisation
 
Auto Update
Auto UpdateAuto Update
Auto Update
 
Classic Query Editor
Classic Query EditorClassic Query Editor
Classic Query Editor
 
Web area-phone-home
Web area-phone-homeWeb area-phone-home
Web area-phone-home
 
MONET研究会 #14
MONET研究会 #14MONET研究会 #14
MONET研究会 #14
 
4d
4d4d
4d
 
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
 
Xslt
XsltXslt
Xslt
 
Journaling slides
Journaling slidesJournaling slides
Journaling slides
 
Unicode-v11-5
Unicode-v11-5Unicode-v11-5
Unicode-v11-5
 
Unicode-v11-0
Unicode-v11-0Unicode-v11-0
Unicode-v11-0
 
アップグレードセミナー
アップグレードセミナーアップグレードセミナー
アップグレードセミナー
 
4D Write Pro
4D Write Pro4D Write Pro
4D Write Pro
 
バックアップと復元
バックアップと復元バックアップと復元
バックアップと復元
 
⽇本語全⽂検索
⽇本語全⽂検索⽇本語全⽂検索
⽇本語全⽂検索
 
⾼解像度ディスプレイ
⾼解像度ディスプレイ⾼解像度ディスプレイ
⾼解像度ディスプレイ
 
ラベルエディター
ラベルエディターラベルエディター
ラベルエディター
 
リストフォーム⼤改造
リストフォーム⼤改造リストフォーム⼤改造
リストフォーム⼤改造
 
正しいクエリの書き⽅
正しいクエリの書き⽅正しいクエリの書き⽅
正しいクエリの書き⽅
 
カスタマイズできる⼊力画面
カスタマイズできる⼊力画面カスタマイズできる⼊力画面
カスタマイズできる⼊力画面
 

Regex