如何在Confirmation code:
Payout:
€66 x 7 Nights: €461
Airbnb Service Fee: -€17
Total Payout: €444
忽略所有数字
#include <iostream>
int main()
{
int theInt = 1337;
int & theReference = theInt;
int * thePointer = &theInt;
std::cout << "int: " << theInt << "\n";
std::cout << "referenz: " << theReference << "\n";
std::cout << "pointer: " << *thePointer << "\n";
std::cout << "pointer: " << *thePointer << "\n";
//std::cout << "foo" << "\n";
return 0;
}
答案 0 :(得分:0)
使用\K
或lookbehind。
\bTotal Payout:\s*\K.+
答案 1 :(得分:0)
Total Payout:\s+\K\D+
您可以在此处使用\K
。
\K resets the starting point of the reported match. Any previously consumed characters are no longer included in the final match
。
参见演示。
答案 2 :(得分:0)
您可以使用?<=
请参阅此模式(?<=Total Payout:)\s+(.*\d+)
然后捕获该组。
查看演示https://regex101.com/r/gM6pO2/4
确认码:
<强>输入强>
Payout:
€66 x 7 Nights: €461
Airbnb Service Fee: -€17
Total Payout: €444
<强>输出强>
€444
答案 3 :(得分:0)
您可以使用/.*(€\d+)/
,即:
<?php
$string = <<< EOF
Confirmation code:
Payout:
€66 x 7 Nights: €461
Airbnb Service Fee: -€17
Total Payout: €444
EOF;
preg_match_all('/.*(€\d+)/si', $string, $matches, PREG_PATTERN_ORDER);
$totalPayout = $matches[1][0];
echo $totalPayout;
//€444
<强>样本:强>