|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 3:20 PM
Points: 1,137,
Visits: 667
|
|
You add it to the SqlFunctionAttribute in the C# code:
public partial class CTSStoredProcs { [Microsoft.SqlServer.Server.SqlFunction(IsDeterministic=true, IsPrecise=true)] public static SqlBoolean RegExValidate( SqlString expressionToValidate, SqlString regularExpression) { Regex regex = new Regex(regularExpression.Value);
return regex.IsMatch(expressionToValidate.Value); } }
... nothing different on the T-SQL side.
-- Adam Machanic SQL Server MVP SQLblog.com: THE SQL Server Blog Spot on the Web
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, April 16, 2013 7:20 AM
Points: 11,
Visits: 90
|
|
good day sirs and madam,
i badly needed help.. i have this regular expression
^(?!.*--)[A-Za-z\d-]+$
it accepts alphanumeric character optionally a dash (single dash only, not consecutive dash) for exampl:
it accepts: 12a-3c-4f3fg 12ertgg2 1-2-3-3-4-3 dffgsfg d-f-f-g-s-f-g
it does not accept: 12-3c-4f&3fg 12e%rt-gg2 d--f-f-g-s-f-g 1-2-3-3-4--3
now i have problem, i cant find any in the .net that accepts the above valid expression with space-a non consecutive space. meaning the it needs to accept alphanumeric with optionally a non-consecutive dash and optionally a non-consecutive space.
can someone help please.
|
|
|
|