lasante23 lasante23 - 1 year ago 67
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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download