lundi 29 juin 2015

Regular expression lookhead lookbehind

I need some help with a regular expression for .NET, I have an input field for a telephone number.

I use a regex to format the value (050 33 11 00) to this format:

+32(0)50/33.11.00

But when I insert following value 09 323 23 56 I want to get following result:

+32(0)9/323.23.56

I've been looking at lookahead but can't find a working solution.

I'm using the folowing regex: (\x2B{1}3{1}2{1}\x28{1}\d{1}\x29{1}\d{2}\/\d{2}\.\d{2}\.\d{2}) which works for the first value.

The regex is placed on a textbox as editMask, so i would like instant live sanitizing.

textEdit.Mask.EditMask = editMask;

Aucun commentaire:

Enregistrer un commentaire