# Context:
USER: use a regex to check `name` for "-XXk" and set tokens = the number XX
ASSISTANT: To use a regex to check for "-XXk" in the `name` and set `tokens` to the number XX, you can modify the `get_model` function in the `aider/models.py` file. Here's the updated code:
```python
aider/models.py
<<<<<<< ORIGINAL
def get_model(name):
models = GPT35_models + GPT4_models
for model in models:
if model.name == name:
return model
tokens = 0
model = Model(name, tokens)
=======
import re
def get_model(name):
models = GPT35_models + GPT4_models
for model in models:
if model.name == name:
return model
match = re.search(r'-([0-9]+)k', name)
tokens = int(match.group(1)) if match else 0
model = Model(name, tokens)
>>>>>>> UPDATED
```
This change imports the `re` module and uses the `re.search()` function to find the "-XXk" pattern in the `name`. If the pattern is found, it sets `tokens` to the number XX.