none
SharePoint desiner do not allow character { and , together in regular expressoin

    Question

  • I am using a regular expression for email validation in SharePoint edit form (data form)

    <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"
      ControlToValidate="ff58{$Pos}"
      ValidationExpression="^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$"
      ErrorMessage="Enter a valid email address." />

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

    it shows an error in design view - Failed setting <g class="gr_ gr_12 gr-alert gr_gramm gr_run_anim Style multiReplace" data-gr-id="12" id="12">processor :</g> 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 Name field of document library and have 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


    Y.M.P






    • Edited by Y.M.P Monday, January 9, 2017 6:55 PM
    Friday, January 6, 2017 9:14 PM

All replies

  • Hi

    I recommend you a workaround to avoid this

    Use only ="^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]+"

    just as a try, use your formula without last $. Same error ?


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.


    Friday, January 6, 2017 10:08 PM
  • <g class="gr_ gr_6 gr-alert gr_gramm gr_run_anim Punctuation only-ins replaceWithoutSep" data-gr-id="6" id="6">Thanks</g> Romeo,

    Also, I want to restrict characters to be entered to 200. Is there any alternative expression for this? Also, why } and, does not work?


    Y.M.P

    Saturday, January 7, 2017 2:05 AM
  • Hi

    you can limit that at field configuration level in GUI directly


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Saturday, January 7, 2017 11:03 AM
  • Hi, It is a system field 'Name' of the document library and there is no way to add validation <g class="gr_ gr_198 gr-alert gr_gramm gr_run_anim Grammar multiReplace" data-gr-id="198" id="198">at</g> GUI.

    Y.M.P

    Monday, January 9, 2017 6:51 PM
  • Hi Y.M.P,

    Yes, there is no way to add validation to the default Name field.

    There is a workaround.

    You could create a new column and copy the value from Name field to the new column. Then add the column validation to the new column. Then modify the view to hide the default Name field.

    More references:

    Examples of common formulas in SharePoint Lists.

    https://support.office.com/en-us/article/Examples-of-common-formulas-in-SharePoint-Lists-d81f5f21-2b4e-45ce-b170-bf7ebf6988b3

    SharePoint Column Validation Examples.

    http://techtrainingnotes.blogspot.sg/2015/10/sharepoint-column-validation-examples.html

    Best regards,

    Sara Fan


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, January 10, 2017 12:58 PM
    Moderator
  • Hi Y.M.P,

    If the reply is helpful to you, you could mark the reply as answer. Thanks for your understanding.

    Best regards,

    Sara Fan


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, February 2, 2017 1:14 AM
    Moderator