Parker Software Ltd Homepage
Forum Home Forum Home > ThinkAutomation Business Process Automation > Scripting
  New Posts New Posts RSS Feed - Regex to get only Numbers from a line
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Regex to get only Numbers from a line

 Post Reply Post Reply
Author
Message
AlexUhde View Drop Down
New User
New User


Joined: 26 Dec 2017
Location: Brisbane
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote AlexUhde Quote  Post ReplyReply Direct Link To This Post Topic: Regex to get only Numbers from a line
    Posted: 18 Nov 2018 at 11:33pm
Hello,
I have a for loop, where I loop trough every line of an email.
I'm trying to get only the numbers returned.
Example email (part):
Quote
Disk 1:
        Disk Reconnection Count 0
        Bad Sector Count 2
        Disk Re-identification Count 0
        Estimated Lifespan -

Disk 2:
        Disk Reconnection Count 0
        Bad Sector Count 0
        Disk Re-identification Count 0
        Estimated Lifespan -
The email might have a different amount of disks listed. 
I wan't to check if any of the values report "more then 0" (like the 2 Bad Sectors in the example)

I tried the LookUp code, which I thought should do it, but it returns the character count per line.
Sub Main()
    ThinkAutomationVariable = ThinkAutomationVariable
    LoopText = AccountVariable("Loop_line")
    '(returns char count) LoopNum = LookFor(LoopText, "\d")
    LoopNum = RegExp.Replace(LoopText, "[^\d]", "")
    AddToLog("LoopNumber = " & LoopNum)
    AccountVariable("Loop_NumberFound") = LoopNum

End Sub
Any help is much appreciated.

Kind regards,
Alex
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.05
Copyright ©2001-2016 Web Wiz Ltd.

This page was generated in 0.063 seconds.