view raw
lasante23 lasante23 - 8 months ago 32
Python Question

Match number between '<<' (regex)

I have the following string

All files | 100 <<222>>

And would like to match the number between
<< >>

How can I do that?

So far I tried this expression


The problem is, that < is a special character, which needs to be escaped. Also, the ? in the first and third group are invalid:


Additionally, I named the group with the number and used \d to match digits instead of *. I tested it here.