Last post Apr 14, 2018 07:22 AM by Abraham Qian
Participant
995 Points
2616 Posts
Apr 13, 2018 07:19 PM|tvb2727|LINK
Say I have this text:
WHERE UserId in [[[UserId]]] AND DeptNbr in [[[DeptNbr]]]
How can I pull out both matches instead of just one?
This will currently get ONE, but I need UserId and DeptNbr so that I can pull data from the database and then replace the ('','','') with my values?
Here is the regex:
Regex ReplaceFlagRegex = new Regex(@"\[\[\[([a-zA-Z0-9_]+)\]\]\]", RegexOptions.IgnoreCase);
Member
650 Points
281 Posts
Apr 14, 2018 07:22 AM|Abraham Qian|LINK
Hi tvb2727,
as far as i know ,Regex class has Matches() Function which will return MatchCollection , We Call this function and Then Enumerate and filter the result .so it think the code snippet above can work .
Look Forward to your reply
best regard
Abraham
Participant
995 Points
2616 Posts
How to find multiple groups using a regular expression
Apr 13, 2018 07:19 PM|tvb2727|LINK
Say I have this text:
WHERE UserId in [[[UserId]]] AND DeptNbr in [[[DeptNbr]]]
How can I pull out both matches instead of just one?
This will currently get ONE, but I need UserId and DeptNbr so that I can pull data from the database and then replace the ('','','') with my values?
Here is the regex:
Member
650 Points
281 Posts
Re: How to find multiple groups using a regular expression
Apr 14, 2018 07:22 AM|Abraham Qian|LINK
Hi tvb2727,
as far as i know ,Regex class has Matches() Function which will return MatchCollection , We Call this function and Then Enumerate and filter the result .so it think the code snippet above can work .
Look Forward to your reply
best regard
Abraham