Umair
Umair

Reputation: 3243

Regex. Continue matching

need help on Regex. Say I have the following text:

* 1 FETCH (UID 1 FLAGS (\\Flag1 \\Flag2 \\Flag3 ....)

Is it possible to extract all of the flags? So a match (.NET) that will contain the groups Flag1, Flag2, Flag3.

I can use

FLAGS \((?<flags>.*?\) 

to get \\Flag1 \\Flag2 \\Flag3 ...., which is close, but not quite there.

Upvotes: 0

Views: 494

Answers (1)

alxx
alxx

Reputation: 9897

Try this (tested online):

((?<flags>\\\\.*?)\s)

Update: this should get rid of the bracket in the end:

(?<flags>\\\\.*?)(\s|\))

Upvotes: 1

Related Questions