This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data Loss Prevention regex not working

Hi,

Have tried to setup UTM to catch danish social security numbers, I have tried this regex:

https://regex101.com/r/ImpkCu/2

^[0-3][0-9][0-1][1-9][0-9]{2}[-\s][0-9]{4}$
For theese combinations

100282 1187
100282-1187

It works in Sophos Central Endpoints, when I create a custom CCL, but not when I add it to UTM.

This one works in UTM:

[0-3][0-9][0-1][1-9]\d{2}[-\s]\d{4}?[^0-9]*|[0-3][0-9][0-1][1-9]\d{2}\d{4}

But takes theese combinations:


1002821187
100282 1187
100282-1187

The first without hyphen and space, gives too many false positives!

 

I'm not a big regex expert, but I cannot figure out why it works in Sophos Central and not UTM.

 

UPDATE:

Tried with this: [0-3][0-9][0-1][1-9][0-9]{2}[-\s][0-9]{4} seemed to work in the UTM, now testing for false positives ;) (Removed ^ and $)

Also tested with boundaries \b like found here:

https://stackoverflow.com/questions/46805702/matching-numbers-with-an-optional-delimiter-in-between



This thread was automatically locked due to age.