MisUszatek
asked on
Regular expression needed for a SharePoint column validation
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).
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@TerryAtOpus
I get the following error message when using this formula: The formula contains a syntax error or is not supported.
I get the following error message when using this formula: The formula contains a syntax error or is not supported.
Terry's RegEx looks just fine to me (it should work). Maybe try this:
AB\d{7}
BTW - those are curly braces, not parenthesis.
ASKER
It still gives me an error. Maybe SharePoint needs specific syntax for this to work?
ASKER
Using instructions from the internet i was able to create this formula that works:
I am still wondering if there is an easier way to do it...
=(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
I am still wondering if there is an easier way to do it...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
http://msdn.microsoft.com/en-us/library/ms434697.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
ASKER
I am good for now - thank you all for help.
ASKER
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.
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.
http://msdn.microsoft.com/en-us/library/az24scfc.aspx