Hi team,
Could someone please help me create a regex pattern to extract a specific price range from a string?
**Example string:"
“5000B\nOn Sale\n$2.14 - $2.38\nGildan\nHeavy Cotton™ Youth T-Shirt\n+43\nXS - XL”
"
**Expected output:“$2.14 - $2.38”
Thank you for your assistance!
Best regards,
Sai Krishna
SorenB
2
Hello @Mada_Sai_Krishna
You could use the Regex below.
\$\d+.\d+ - \$\d+.\d+
This looks for a dollar value range in decimal.
Regards
Soren
@Mada_Sai_Krishna,
Use this regex"
\$\d+\.\d{2} - \$\d+\.\d{2}
Hi @SorenB some times my string value comes like this
string=“2700\nCloseout\n$4.72\nGildan\nUltra Cotton® Sleeveless T-Shirt\nS”
it will not works for both ?
Hi @ashokkarale some times my string value comes like this
string=“2700\nCloseout\n$4.72\nGildan\nUltra Cotton® Sleeveless T-Shirt\nS”
it will work both ?
@Mada_Sai_Krishna
This pattern \$\d+\.\d{2}( - \$\d+\.\d{2})?
will match both single prices like "$4.72"
and price ranges like "$2.14 - $2.38"
Thankyou it’s working fine @ashokkarale
Hello @ashokkarale ,
can you give me the entire expression.
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.