Solved

Regular expression needed for a SharePoint column validation

Posted on 2013-06-16
11
938 Views
Last Modified: 2013-06-17
I need a column validation (SharePoint 2010) to check if the value is in a proper format. The format is: AB1234567 (capital A, capital B and then 7 digits).
0
Comment
Question by:MisUszatek
  • 5
  • 5
11 Comments
 
LVL 35

Assisted Solution

by:Terry Woods
Terry Woods earned 100 total points
ID: 39252195
Perhaps try this?

AB[0-9]{7}

Open in new window

0
 
LVL 23

Expert Comment

by:nemws1
ID: 39253355
Speaking of, can anyone verify *which* of Microsoft's multiple RegEx implentations Sharepoint uses?  Is it the same one as C#?

http://msdn.microsoft.com/en-us/library/az24scfc.aspx
0
 

Author Comment

by:MisUszatek
ID: 39253482
@TerryAtOpus
I get the following error message when using this formula: The formula contains a syntax error or is not supported.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 23

Expert Comment

by:nemws1
ID: 39253564
Terry's RegEx looks just fine to me (it should work).  Maybe try this:
AB\d{7}

Open in new window

0
 
LVL 23

Expert Comment

by:nemws1
ID: 39253565
BTW - those are curly braces, not parenthesis.
0
 

Author Comment

by:MisUszatek
ID: 39253617
It still gives me an error. Maybe SharePoint needs specific syntax for this to work?
0
 

Author Comment

by:MisUszatek
ID: 39253625
Using instructions from the internet i was able to create this formula that works:

=(LEN([Case #])=9)
+(MID([Case #],1,1)="A")
+(MID([Case #],2,1)="B")
+(CODE(MID([Case #],3,1))>47)
+(CODE(MID([Case #],3,1))<58) 
+(CODE(MID([Case #],4,1))>47)
+(CODE(MID([Case #],4,1))<58) 
+(CODE(MID([Case #],5,1))>47)
+(CODE(MID([Case #],5,1))<58) 
+(CODE(MID([Case #],6,1))>47)
+(CODE(MID([Case #],6,1))<58) 
+(CODE(MID([Case #],7,1))>47)
+(CODE(MID([Case #],7,1))<58) 
+(CODE(MID([Case #],8,1))>47)
+(CODE(MID([Case #],8,1))<58) 
+(CODE(MID([Case #],9,1))>47)
+(CODE(MID([Case #],9,1))<58) 
=17

Open in new window


I am still wondering if there is an easier way to do it...
0
 
LVL 23

Accepted Solution

by:
nemws1 earned 200 total points
ID: 39253638
Okay... that looks much more like Excel syntax rather than a RegEx (which I thought Sharepoint *did* support)
0
 
LVL 23

Expert Comment

by:nemws1
ID: 39253683
According to this, you *can* use a RegEx, but you would need to use a custom field and write some C# code in order to call RegEx().  Probably too much of a headache.

http://msdn.microsoft.com/en-us/library/ms434697.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
0
 

Author Comment

by:MisUszatek
ID: 39253695
I am good for now - thank you all for help.
0
 

Author Comment

by:MisUszatek
ID: 39253708
I've requested that this question be closed as follows:

Accepted answer: 0 points for MisUszatek's comment #a39253625
Assisted answer: 100 points for TerryAtOpus's comment #a39252195
Assisted answer: 200 points for nemws1's comment #a39253683

for the following reason:

Own solution.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
User Profile Issue in SHarePoint 9 65
SharePoint Search option? 3 37
Sharepoint document already opened 2 41
Is upgrading SQL from 2012 to 2014 Safe 5 15
I recently came across an issue with a MOSS 2007 deployment where access into some sub-sites were denied, even for the MOSS farm administrators. A bit of background to the setup of this MOSS farm; this was a three server setup, consisting of a fr…
We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question