Sharepoint Column Validation - Regex

Ruan Swart 21 Reputation points
2021-08-19T06:44:39.437+00:00

i would like to do data validation on a column in SharePoint to ensure the naming convention of my documents are correct.

Im familiar with RegEx and was able to build the below Expression :
[A-Z]{4}-[A-Z]{3,6}-[A-Z0-9]{2}-[A-Z0-9]{2}-[A-Z]{2,3}-[A-Z]{1,3}-[0-9]{4}-[A-Za-z0-9]+

is there anyone that can assist converting this to a format that Sharepoint understands?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,684 questions
{count} votes

Accepted answer
  1. Echo Du_MSFT 17,116 Reputation points
    2021-08-20T06:55:24.753+00:00

    Hi @Ruan Swart ,

    Welcome to Q&A Forum!

    According to my research and testing, SharePoint Column Validation cannot support such a complex RegEx Expression. Because the Validation Formula must be 1024 characters or fewer.

    124880-c1.png

    For example:

    [A-Z]{4}- requires the following Formula:

    =IF(AND(LEN(Test)=5,CODE(MID(Test,1,1))>64,CODE(MID(Test,1,1))<91,CODE(MID(Test,2,1))>64,CODE(MID(Test,2,1))<91,CODE(MID(Test,3,1))>64,CODE(MID(Test,3,1))<91,CODE(MID(Test,4,1))>64,CODE(MID(Test,4,1))<91,MID(Test,5,1)="-"),TRUE,FALSE)  
    

    124945-c3.png

    Thanks,
    Echo Du

    =========================================

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ruan Swart 21 Reputation points
    2021-08-20T08:19:35.583+00:00

    Thank you for the great feedback :)

    0 comments No comments