SPUtility.IsValidStringInput Method

Determines whether the specified text is in a valid format as specified by a regular expression.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

public static bool IsValidStringInput(
	string regexp,
	string newValue


Type: System.String

The regular expression specifying the valid format.

Type: System.String

The text to validate.

Return Value

Type: System.Boolean
Returns true if the text is in the specified format; otherwise, false.

This method determines whether the value of the newValue parameter matches the regular expression in the regexp parameter.