主題の件で教えてください。
正規表現を使ってメール本文から値を抽出して、
抽出した値をデータテーブル変数の最終行に追記したいです。
教えてほしい事は
以下でして、代入アクティビティを使用して
メール本文の1Mから2Mまでにある各値を
抽出して代入したいです。
以下、ネットで調べて実施しましたが、
何も値を抽出出来ないです。
正規表現の式が合っているか教えてほしいです。
よろしくお願いいたします。
・代入
matches = System.Text.RegularExpressions.Regex.Matches(mailBody, “(?<=1M\s+)(-?\d+.?\d*\s*)+(?=2M)”)
デバッグのローカル画面にて
代入後のmatchesの値は以下でした。
MatchCollection(0){}
Matches MatchCollection型
mailBody String型
メール本文の内容は以下です。
bid
offer
1M
-1.0%
-2.0%
-3.8%
2M
Yoichi
(Yoichi)
2
こんにちは
一旦以下のパターンで1Mと2Mの間を抽出して
(?<=1M)[\s\S]+?(?=2M)
その抽出したものから以下のパターンで数字を抽出すると良いかと思います。
-?[\d.,]+%

いつもありがとうございます!
matches = System.Text.RegularExpressions.Regex.Matches(mailBody, “(?<=1M)[\s\S]+?(?=2M)”)
教えていただいた通り、1Mから2Mまでの間を抽出できました。
ここからなんですが、
-?[\d.,]+%
これはどのようにして使用すれば良いでしょうか。
代入アクティビティでよろしいでしょうか。
Yoichi
(Yoichi)
4
同様に代入アクティビティを用いて System.Text.RegularExpressions.Regex.Matchesで抽出します。
第一引数は1Mから2Mの抽出値を与えることになります。
vrdabberu
(Varunraj Dabberu)
5
Hi @Tatsuya.d
Check the below xaml and the screesnshots are also attached for your reference:
Output = System.Text.RegularExpressions.Regex.Match(Input,"(?<=1M)[\s\S]*?(?=2M)").Value.Trim
Matches = System.Text.RegularExpressions.Regex.Matches(Output,"[ .A-Za-z-\d+%]+")
xaml:
Sequence15.xaml (11.2 KB)
Screenshot:

分かっておらず申し訳ございません。
以下でよろしいでしょうか。
matches = System.Text.RegularExpressions.Regex.Matches(matches, “-?[\d.,]+%”)
vrdabberu
(Varunraj Dabberu)
7
Hi @Tatsuya.d
Hi @Tatsuya.d
Check the below xaml and the screesnshots are also attached for your reference:
Output = System.Text.RegularExpressions.Regex.Match(Input,"(?<=1M)[\s\S]*?(?=2M)").Value.Trim
Matches = System.Text.RegularExpressions.Regex.Matches(Output,"[ .A-Za-z-\d+%]+")
xaml:
Sequence15.xaml (11.2 KB)
Screenshot:

Regards
ありがとうございます!!!
抽出することが出来ました!!!
1 Like
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.