Is it possible to cancel a `regex.match` operation if takes more than 10 seconds to complete?

I'm using an huge regex to match a specific text, and sometimes may work, and sometimes can fail...

regex: `MINISTÉRIO(?:[^P]*(?:P(?!ÁG\s:\s\d+\/\d+)[^P]*)(?:[\s\S]*?))PÁG\s:\s+\d+\/(\d+)\b(?:\D*(?:(?!\1\/\1)\d\D*)*)\1\/\1(?:[^Z]*(?:Z(?!6:\s\d+)[^Z]*)(?:[\s\S]*?))Z6:\s+\d+`

Working example: <https://regex101.com/r/kU6rS5/1>

So.. i want cancel the operation if takes more than 10 seconds. Is it possible? I'm not finding anything related in sof

Thanks.