Use the Regex.Matches
method instead:
string[] result =
Regex.Matches(str, @"\[.*?\]").Cast<Match>().Select(m => m.Value).ToArray();
More Related Contents:
- How to extract decimal number from string in C#
- Get values between curly braces c#
- How do I get two numbers between two words (C#) [closed]
- Find and extract a number from a string
- Easiest way to split a string on newlines in .NET?
- Split a string by another string in C#
- Get string between two strings in a string
- C# Splitting Strings?
- How can I strip HTML tags from a string in ASP.NET?
- How can I split a string with a string delimiter? [duplicate]
- How do I replace multiple spaces with a single space in C#?
- Split a string with delimiters but keep the delimiters in the result in C#
- Add spaces before Capital Letters
- Splitting a string / number every Nth Character / Number?
- How to keep the delimiters of Regex.Split?
- Split a string with delimiters but keep the delimiters in the result in C#
- Remove HTML tags from string including   in C#
- Remove text in-between delimiters in a string (using a regex?)
- Need to perform Wildcard (*,?, etc) search on a string using Regex
- Regex : how to get words from a string (C#)
- Regex split string but keep separators
- split a string on newlines in .NET
- Regex nested parentheses
- How to remove empty lines from a formatted string
- C# Regex.Split: Removing empty results
- Regular expression to find and remove duplicate words
- Replace non-numeric with empty string
- Parsing formatted string
- Regular expression to split string and number
- splitting a string based on multiple char delimiters