Vishal
Vishal

Reputation: 178

Regex to capture a deployment task

Deployment task '[5.1.4] **Configure Redis, service bus and Update Databases and Samples**' 
with id '04d8e453-7f22-420d' and with scenario_id '9349bff9-9e41-4c26-9a90'

Given the above text, I need a regex which should give this output:

Configure Redis, service bus and Update Databases and Samples

Upvotes: 1

Views: 26

Answers (1)

Martin Brandl
Martin Brandl

Reputation: 58931

Assuming that the text ends with a single quote, this is the regex you are looking for:

Deployment task '\[.*?\]\s*([^']+)

And here is an example how you can grab the value:

[regex]::Match($yourString, "Deployment task '\[.*?\]\s*([^']+)").Groups[1].Value

Upvotes: 3

Related Questions