regex - Modify a regular expression to allow leading/trailing whitespace -


my validation expression :

validationexpression="^(?:(?:(?:0?[13578]|1[02] )(\/|-)31 )|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30 )))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9] )$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8] ))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9] )$|^(0?2(\/|-)29 )(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00 )|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26] ))$"

how can change allow whitespace @ start or end of string?

try:

validationexpression="^\s*(?:(?:(?:0?[13578]|1[02] )(\/|-)31 )|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30 )))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9] )$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8] ))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9] )$|^(0?2(\/|-)29 )(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00 )|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26] ))\s*$" 

\s* matches 0 or more whitespace characters. inserted @ start , end.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -