Page 1 of 1

regex how to pull a number from X until next number?

Posted: August 15th, 2018, 10:03 pm
by themohawkninja
Hello,

I am trying to write a skin to parse my robocopy log, however I can't figure out how to get it to pull the numbers at the bottom of the file.

The line in question:

Code: Select all

    Dirs :     29394         0     29394         0         0         0
I thought that something like "(?siU)Dirs : (.*) {[0-9]+:[0-9]+}" or "(?siU)Dirs : ([0-9]+:[0-9]+) {[0-9]+:[0-9]+}" would work, however I just get my substitute. (Unfortunately, the wiki link to regex for Rainmeter went to a 404)

So, how would I say in regex "Parse the number of an unknown size between 'Dirs :' and the next number of unknown size"

Thank you,

Re: regex how to pull a number from X until next number?

Posted: August 15th, 2018, 11:22 pm
by FreeRaider
Try this one:

Code: Select all

(?siU).*dirs :.*(\d{1,}+).*(\d{1,}+).*(\d{1,}+).*(\d{1,}+).*(\d{1,}+).*(\d{1,}+)

Re: regex how to pull a number from X until next number?

Posted: August 15th, 2018, 11:39 pm
by themohawkninja
Nvm, I figured it out. In addition to changing the format, I was not taking into account spaces.