.net - Regular expression lookhead lookbehind -
i need regular expression .net, have input field telephone number.
i use regex format value (050 33 11 00
) format:
+32(0)50/33.11.00
but when insert following value 09 323 23 56
want following result:
+32(0)9/323.23.56
i've been looking @ lookahead can't find working solution.
i'm using folowing regex: (\x2b{1}3{1}2{1}\x28{1}\d{1}\x29{1}\d{2}\/\d{2}\.\d{2}\.\d{2})
works first value.
the regex placed on textbox editmask, instant live sanitizing.
textedit.mask.editmask = editmask;
you can use following replacement:
\b0(\d{1,2})\s+(\d{2,3})\s+(\d{2})\s+(\d{2})\b
this regex match full "words" starting 0
, followed 1 or 2 digits, whitespace, 2 or 3 digits, whitespace, 2 digits , again whitespace , 2 digits.
replace +32(0)$1/$2.$3.$4
see demo.
Comments
Post a Comment