[Resolved] {code ...} for multi-language websites, You need to extract $299.00, of which $ is uncertain, because there may be symbols such as $, £, and so on. It can be determined that there is a space before $299.00, after the decimal point... [resolved]
echo '
';$pa = '%(.*?)
%sim';preg_match($pa, trim($message), $arr);if(strpos("Welcome back",$message)){ preg_match('/.\d{1,}.\d{1,2}/', $arr[1], $arr);}else{ preg_match('/.\d{1,}.\d{1,2}/', $arr[1], $arr);}echo($arr[0]);
========================================================== ======================================
For multi-language websites, You need to extract $299.00, of which $ is uncertain because it may be $, £, and other symbols,
It can be determined that $299.00 contains a space, and there are two digits after the decimal point,
In other words:
Your account has an unpaid bill amount of $299.00. Please complete the payment as soon as possible.
Or
Your account has an outstanding balance of $299.00. Please make a payment at your earliest convenience.
Extracted to $299.00.
Chinese display:
× Welcome back, Tao!
Your account has an unpaid bill amount of $299.00. Please complete the payment as soon as possible.
Make payment
× Welcome back, Tao!
Your account has an outstanding balance of $299.00. Please make a payment at your earliest convenience.
Make Payment
Reply content:
[Resolved]
echo '
';$pa = '%(.*?)
%sim';preg_match($pa, trim($message), $arr);if(strpos("Welcome back",$message)){ preg_match('/.\d{1,}.\d{1,2}/', $arr[1], $arr);}else{ preg_match('/.\d{1,}.\d{1,2}/', $arr[1], $arr);}echo($arr[0]);
========================================================== ======================================
For multi-language websites, You need to extract $299.00, of which $ is uncertain because it may be $, £, and other symbols,
It can be determined that $299.00 contains a space, and there are two digits after the decimal point,
In other words:
Your account has an unpaid bill amount of $299.00. Please complete the payment as soon as possible.
Or
Your account has an outstanding balance of $299.00. Please make a payment at your earliest convenience.
Extracted to $299.00.
Chinese display:
× Welcome back, Tao!
Your account has an unpaid bill amount of $299.00. Please complete the payment as soon as possible.
Make payment
× Welcome back, Tao!
Your account has an outstanding balance of $299.00. Please make a payment at your earliest convenience.
Make Payment
From the code point of view, the content of this code should not change except the name and amount, so it is easier to do.
Directly go to the matching amount/\ s (. \ d + \. \ d {2})/g. The premise is that for this section of code, if it is the entire page, you need to restrict the matching to this section of code ..
Resolved:
echo '
';$pa = '%(.*?)
%sim';preg_match($pa, trim($message), $arr);if(strpos("Welcome back",$message)){ preg_match('/.\d{1,}.\d{1,2}/', $arr[1], $arr);}else{ preg_match('/.\d{1,}.\d{1,2}/', $arr[1], $arr);}echo($arr[0]);
I don't know the subject's purpose. What is the purpose of extracting this amount? Is it necessary to make a payment? Should I go to the server to verify the payment? After all, this price front end can be tampered.
If you only need to match, you can use this expression.
$ Pattern = '# ([\ $ | ¥ | £1-9] [0-9] *. [0-9] {2}) # '; // $ subject =' Your account has an unpaid bill amount of $299.00. Please complete the payment as soon as possible. '; $ Subject = 'your account has an outstanding balance of $299.00. please make a payment at your earliest convenience. '; preg_match ($ pattern, $ subject, $ a); var_dump ($ a); // output: array (2) {[0] => string (7) "$299.00" [1] => string (7) "$299.00 "}
I don't know why it turned into two? Unknown reason