Im trying to search for three pieces of data from a string and they are:

```
first name, space ,last name  (?=[A-Z][a-z]+\s[A-Z][a-z]+) 
//AND
first name ,space ,last name ,and suffix (?=[A-Z][a-z]+\s[A-Z][a-z]+\s[A-Z][a-z]+) 
//AND,
age   (?=[0-9]{2})

```

from several tutorials I've seen it seems that these three patterns: 

```
(?=[A-Z][a-z]+\s[A-Z][a-z]+)(?=[A-Z][a-z]+\s[A-Z][a-z]+\s[A-Z][a-z]+)(?=[0-9]{2})

```

together should be my solution, but its not working.... any suggestions....(its a php script and im using preg\_match\_all)

my script:

```
$content = file_get_contents('http://www.somesite.com');
$pattern = '/(?=[A-Z][a-z]+\s[A-Z][a-z]+)(?=[A-Z][a-z]+\s[A-Z][a-z]+\s[A-Z][a-z]+)(?=[0-9]{2}) /';
if(preg_match_all($pattern,$content,$matches))
{
// has the pattern, do something
//$matches has all the matches from preg_match

  }

```
['https://Stackoverflow.com/questions/17937982', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/497763/']
That multiple-lookahead trick is for times when you know certain components must be present, but you don't know what order they'll appear in. You see it most often in regexes that enforce strong password policies. 

Your problem is much simpler; the components always come in the same order, but the last one is optional. That's much easier:

```
'/\b([A-Z][a-z]*)\s+([A-Z][a-z]*)(?:\s+([0-9]{2}))?\b/'

```

The first name is captured in group #1, the last name will be in group #2, and if there's a suffix you'll find it in group #3.
```
([a-zA-Z]+\s+[a-zA-Z]+\s+[a-zA-Z0-9])

```

You can test your RegEx with tools like <http://www.cyber-reality.com/regexy.html>