Jump to content

How to read a number from a milti line strings


Recommended Posts



I have message with three lines as below:


File(s) Added: 11 of 443Files Matched: 4533Last Matched File = 4343.txt


I will always get a message similar to above format. But the numbers will be different. I just want to read the number bolded. That number can be 3 digits to 20 digits. How can i have a vbscript to read the number.


I started but I am lost.

   msg = "File(s) Added: 11 of 443                   Files Matched: 4533                   Last Matched File = 4343.txt"Of_Position = instr(msg, "of") readtheMaxNumber = mid(msg, Of_Position + 2) msgbox readtheMaxNumber

Please help.


Link to comment
Share on other sites

The easiest way would probably be to split the text up into individual lines, and then find everything in the first line between the last space and the end of the line. You could probably also use a regular expression.

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
  • Create New...