It is currently March 28th, 2024, 3:05 pm

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

Get help with creating, editing & fixing problems with skins
Post Reply
themohawkninja
Posts: 3
Joined: July 17th, 2017, 9:46 pm

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

Post 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,
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

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

Post by FreeRaider »

Try this one:

Code: Select all

(?siU).*dirs :.*(\d{1,}+).*(\d{1,}+).*(\d{1,}+).*(\d{1,}+).*(\d{1,}+).*(\d{1,}+)
themohawkninja
Posts: 3
Joined: July 17th, 2017, 9:46 pm

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

Post by themohawkninja »

Nvm, I figured it out. In addition to changing the format, I was not taking into account spaces.
Post Reply