Jump to content

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

Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...