Hi All,
I need to extract numeric value from captured text through macro script.Can anyone from this forum help me out in this.
How to extract numeric value from captured text
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 7
- Joined: Thu Feb 18, 2016 9:58 am
Re: How to extract numeric value from captured text
So you need to parse the text to extract a particular segment, in your case you want a number. To help we'd need to have a good idea of what the text looks like. Parsing is very specific to the text string being evaluated.
-
- Pro Scripter
- Posts: 70
- Joined: Sun May 03, 2009 11:49 pm
- Location: AU
Re: How to extract numeric value from captured text
Agree with JRL.
You could parse using regex as starting point with something like this:
You could parse using regex as starting point with something like this:
Code: Select all
Let>string=test_#getThis123_andThis456number#only from string
Let>pattern=[+\d ]*
RegEx>%pattern%,%string%,0,arrM,numM,0
Let>i=0
Let>sTmp=
If>numM>0
Repeat>i
Add>i,1
Concat>sTmp,arrM_%i%
Until>i=%numM%
EndIf
MessageModal>%sTmp%
Loving MS's Capabilities!!!