I've got the following string:

> 
> {!ex=track\_created\_f}track\_created\_f:[NOW/DAY-3MONTHS/DAY TO NOW/DAY]
> 
> 
> 

I would like to match/extract **track\_created\_f** and **NOW/DAY-3MONTHS/DAY TO NOW/DAY**. The {!ex=track\_created\_f} might or might not be present at all times, so the regex should not rely on this part. 

**However, it is the second track\_created\_f (and not the track\_created\_f which is a part of !ex=track\_created\_f) which I need to match.**

What I've got so far is the following ([see this link for live preview](http://www.phpliveregex.com/p/1g2)):

```
[^.*(\w+)\:\[(.*)?\]$]

```

However, this just gives me :

```
Array
(
    [0] => {!ex=track_created_f}track_created_f:[NOW/DAY-3MONTHS/DAY TO NOW/DAY]
    [2] => f
    [2] => NOW/DAY-3MONTHS/DAY TO NOW/DAY
)

```

What I'm having trouble to get a real grip on is how I can use regex to match only the part(s) of the string which I'd like to match, and only return that part. As it is now, (0) the entire string is being returned along with (1) the not so good match of **track\_created\_f** and (2) the match of **NOW/DAY-3MONTHS/DAY TO NOW/DAY**.

I've been trying to figure this one out by reading the docs, but I'm uncertain as to whether I'm getting things right - particularly the optional '?' clauses I've put in. Is that the right way to match subsets of strings at all?