I have probably completely missed something, but here is what I have:
- -- Need to prevent inadvertent release of phone numbers.
- -- all numbers in the form nnn-nnnn
- -- may or may not be delimited (e.g, tab, comma, space, whatever)
- -- do NOT block journal articles or study numbers having similar (but not identical) form -- for example xxxnnn-nnnnxxx (yeah, sort of contradicts 'delimited', but "x" are alphanumeric only )
So, I have
(\A|\s|\W)\d{3}-\d{4}(\Z|\s|\W)
Which works! Almost the way I want. Almost. However, \W
is ^a-zA-Z0-9_
and _
is a potential delimiter. Already tried replacing \W
with ^a-zA-Z0-9
with no success (actually, worse), but perhaps specified improperly? FWIW, this will be evaluated by .NET engine.
Aucun commentaire:
Enregistrer un commentaire