Question: I have a string given below.

```
AppCodename: Mozilla<br>Appversion: 5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/41.0.2272.76 Chrome/41.0.2272.76 Safari/537.36<br>

```

I want to extract `Mozilla` from the above string. I use the following python program.

```py
import re
import json

with open('data.txt','rb') as f:                                                                                                                                                               
    data = json.load(f)
    message = data['Message']
    appcodename = re.sub('.+AppCodename: ([^<br>])(.*)',r'\1',message,1)
    print('appcode name {}'.format(appcodename))

```

The output that I get is 

```
appcode name M

```

What is wrong with my regex.

Answer: 
You may consider matching alot easier than replacing:

```
appcodename = re.search('AppCodename: (\w+)', message).group(1)
print('appcode name {}'.format(appcodename))

```

[**eval.in**](https://eval.in/356149)
Use the following `regex`:

```
# match anything after AppCodename: and before <br>.
'.*AppCodename: ([\w]+?)<br>(.*)'

```

Output:

```
appcode name Mozilla

```