代码优化
This commit is contained in:
@@ -35,7 +35,13 @@ public class EmailParseForm95555(
|
||||
DateTime? occurredAt
|
||||
)[]> ParseEmailContentAsync(string emailContent)
|
||||
{
|
||||
var pattern = "您账户(?<card>\\d+)于.*?(?<type>收入|支出|消费|转入|转出)?.*?在?(?<reason>.+?)(?<amount>\\d+\\.\\d{1,2})元,余额(?<balance>\\d+\\.\\d{1,2})";
|
||||
var pattern =
|
||||
"您账户(?<card>\\d+)" +
|
||||
"于.*?" + // 时间等信息统统吞掉
|
||||
"(?:(?<type>收入|支出|消费|转入|转出).*?)?" + // 可选 type
|
||||
"(?:在(?<reason>.*?))?" + // 可选 reason(“财付通-微信支付-这有电快捷支付”)
|
||||
"(?<amount>\\d+\\.\\d{1,2})元,余额" +
|
||||
"(?<balance>\\d+\\.\\d{1,2})";
|
||||
|
||||
var matches = Regex.Matches(emailContent, pattern);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user