I am using a regular expression for email validation and to limit the number of character in SharePoint edit form (data form webpart)

<asp:TextBox runat="server" id="ff58{$Pos}" ControlMode="Edit" FieldName="Email" text="{@FileLeafRef}" __designer:bind="{ddwrt:DataBind('u',concat('ff58',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@FileLeafRef')}" />

<SharePoint:InputFormRegularExpressionValidator ID="Validator" runat="server" Display="Dynamic" SetFocusOnError="true"
  ErrorMessage="Enter a valid email address." />

In validationExpression, it does not allow me to use '{' and it thinks it is a Xpath expression. If I am not using '{' in expression it works fine.

In Design view of form, it shows an error :

Failed setting processor stylesheet : 0x80004005 : Expected token '}' found ','. ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2-->,<--4}$"

Also, I want to limit the number of characters to 90 in another field and found this expression - /^[a-zA-Z]{1,90}$/ Is there any regular expression that I can use to limit the number of character validation which does not have { and, for it? or any way to use { and, in SharePoint form

  • Did you try escaping the '{' character by putting a '\' character in front? I haven't tried it myself so I don't know if it will work or not, just an idea. – Arin Zandbergen Jan 6 '17 at 22:58
  • Yes, I tried but did not work. – Y.M.P Jan 9 '17 at 18:06

Put "{" in a workflow variable and try to use that workflow variable in your statement.

  • Hi Farooqi, I not using it in workflow. I want to use it on the editform. – Y.M.P Jan 9 '17 at 18:08

Try this.





^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~] |(?@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.