Aaron Martinez
Aaron Martinez

Reputation: 5

Find everything after a string using Regex

I need to pull "processor" and everything after in the string. I'm trying to figure this out with Regex.

\\aaronmartinez\processor(0)\% idle time  
\\aaronmartinez\processor(1)\% idle time  
\\aaronmartinez\processor(2)\% idle time  
\\aaronmartinez\processor(3)\% idle time  
\\aaronmartinez\processor(4)\% idle time   
\\aaronmartinez\processor(5)\% idle time  
\\aaronmartinez\processor(6)\% idle time  
\\aaronmartinez\processor(7)\% idle time  
\\aaronmartinez\processor(_total)\% idle time

Upvotes: 0

Views: 60

Answers (1)

Federico Piazza
Federico Piazza

Reputation: 30995

You can use a simple regex like this:

(processor.*)

Working demo

enter image description here

As you asked, the idea is to capture processor and everything else with .*

Match information:

MATCH 1
1.  [15-39] `processor(0)\% idle time`
MATCH 2
1.  [55-79] `processor(1)\% idle time`
MATCH 3
1.  [95-119]    `processor(2)\% idle time`
MATCH 4
1.  [135-159]   `processor(3)\% idle time`
MATCH 5
1.  [175-199]   `processor(4)\% idle time`
MATCH 6
1.  [215-239]   `processor(5)\% idle time`
MATCH 7
1.  [255-279]   `processor(6)\% idle time`
MATCH 8
1.  [295-319]   `processor(7)\% idle time`
MATCH 9
1.  [335-364]   `processor(_total)\% idle time`

Upvotes: 2

Related Questions