I want to split text in my `html` using `<br>` tags. If the text is longer than 50 characters, I want to replace last space before 10 characters by `<br>`.

The text is in `<span class="value">TEXT</span>`

For example `<span class="value">cccc cc cccccc cccc cc c</span>`

Will became: `<span class="value">cccc cc<br>cccccc<br>cccc cc c</span>` so every line can have at most 10 characters.

I've created a regex for this which can probably find such tags but can't figure out how to extract text from matched group and then replace it.

```
snippet = re.sub(r'<span class="value">(.*)<\/span>', 
                 r'<span class="value">\1<\/span>'.(divide text using <br> tags) 

```

Do you know how to do that?