Micro Focus QTP (UFT) Forums
Return the last number of “Test” - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: Return the last number of “Test” (/Thread-Return-the-last-number-of-%E2%80%9CTest%E2%80%9D)



Return the last number of “Test” - mv8167 - 02-04-2012

How can I use RegEx to just return the last number of “Test”?

Code:
Test = "NestedGrid1" or Test = "NestedGrid15"

To return 1 or 15?

I did figure this out:
xNGNum = replace(Test, "NestedGrid","")
but i am curious if there is a better way.

thx


RE: Return the last number of “Test” - rajpes - 02-04-2012

This is another way
mid(test,11,len(test))


RE: Return the last number of “Test” - mv8167 - 02-05-2012

Rajpes,

thx man ;-)

Can you please explain this? Should it not be mid but left? I thought mid goes from the middle?

It's ok, i will look this up again. thx


RE: Return the last number of “Test” - rajpes - 02-05-2012

Lorena,
one advise for you.You need to start exploring things in help documentation regularly.
mid is a very basic function in vbscript



RE: Return the last number of “Test” - mv8167 - 02-07-2012

Rajpes.

Thx, but i did try to look this up. I do every time do a search. I even look online but most of the Forum sites from my work are blocked. For some reason, this site is not as of yet. I have found tons of help here, thx for your help.

Advise noted ;-)