Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
価格帯形式を検証しようとしています。文字列のシーケンスは次のとおりです。
"MSRP $250.00 - Event Price $129.00"
私はこのように試しました:
String t=price1.replace("$","T"); t= t.replace(" ", ""); MSRPT([0-9]+).([0-9]+)-EventPriceT([0-9]+).([0-9]+)
しかし、それは一致していません。
ありがとう
使用する:
MSRP\s\$([0-9]+)\.([0-9]+).*?\$([0-9]+)\.([0-9]+)
エスケープする必要があることに注意してください$-.ドットは「任意の」文字です
$
.
しかし、私は次のように書きます:
MSRP\s+\$([\d\.]+).*?Event\sPrice\s+\$([\d\.]+)
そして、価格値の文字列が $1 と $2 にあることになります