wingyip
wingyip

Reputation: 3536

Return each occurrence of string

I have a very long string that may contain versions of another string. The format of the string that I am looking for within the main string will be

<umbraco:macro ??? />

The ??? Will be different in each case but I need to get each instance of this string into an array so I can use I csharp code to process.

Does anyone know how I can achieve this?

Am using C# .Net code to run the regex by the way.

Upvotes: 0

Views: 79

Answers (1)

Nick Humrich
Nick Humrich

Reputation: 15795

Here is the regex for you:

<umbraco:macro (.*?) [\/]>

View test cases here: https://regex101.com/r/pY5vB5/1

Then you just need to pull out the stuff in the capture groups.

Upvotes: 1

Related Questions