Question: I've found a lot of examples of how to **check** something using regex, or how to split text using regular expressions.

But how can I extract words out of a string ?

Example:

```
aaaa 12312 <asdad> 12334 </asdad>

```

Lets say I have something like this, and I want to extract all the numbers [0-9]\* and put them in a list.

Or if I have 2 different kind of elements:

```
aaaa 1234 ...... 1234 ::::: asgsgd

```

And I want to `choose digits that come after .....` and `words that come after ::::::`

Can I extract these strings in a single regex ?

Answer: 
Here's a solution for your first problem:

```
   class Program
    {
        static void Main(string[] args)
        {
            string data = "aaaa 12312 <asdad> 12334 </asdad>";

            Regex reg = new Regex("[0-9]+");

            foreach (var match in reg.Matches(data))
            {
                Console.WriteLine(match);
            }

            Console.ReadLine();
        }
    }

```
```
Regex itemsRegex = new Regex(@"(\d*)");
MatchCollection matches = itemsRegex.Matches(text);

int[] values = matches.Cast<Match>().Select(m => Convert.ToInt32(m.Value)).ToArray();

```