# Find digit with decimal point w/StringRegExp

## Recommended Posts

I am retrieving a string from a scale and need to pull out the weight from it. The string is:

\$gWeightstring0 = "SNG/W+ 999.9 lb"

I have tried:

\$gWeight = StringRegExp(\$gWeightstring0, '([0-9]{1,4})', 1)

I want to understand StringRegExp better but found nothing in help file on decimal points (or maybe I didn't understand fully when I did read it)

so I tried:

\$gWeight = StringRegExp(\$gWeightstring0, '([:xdigit:]{1,4})', 1)

Can someone help me understand this? Thanks

##### Share on other sites

Maybe Jaboowaki

ps: crazy avatar u got bro

[font="verdana, geneva, sans-serif"] [/font]

##### Share on other sites

Thank you for the help, while I was out I guessed this <autoit> \$gWeight1 = StringRegExp(\$gWeightstring0, '([0-9]{1,4})', 1)

\$gWeight2 = StringRegExp(\$gWeightstring0, '[0-9]+(.[0-9]{1,1})?', 1)

\$gWeight = \$gWeight1[0] & \$gWeight2[0]</autoit>so I feel I am starting to understand

69255, Thanks for the correct StringReqExp solution, i will change mine, I am using AutoIt to automate our warehouse.

## Create an account

Register a new account

×

• Wiki

• Back

• Git