Skip to content

Commit 63425e8

Browse files
authored
Add link to RegEx docs (#11425)
1 parent a6a6ed7 commit 63425e8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

xml/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,27 @@
5050
<Docs>
5151
<summary>Specifies that a data field value in ASP.NET Dynamic Data must match the specified regular expression.</summary>
5252
<remarks>
53-
<format type="text/markdown"><![CDATA[
54-
53+
<format type="text/markdown"><![CDATA[
54+
5555
## Remarks
56-
You apply the RegularExpressionAttribute attribute to a property when you need to validate values for the property against a regular expression. The regular expression enables you to specify very precisely the format of valid values. The Pattern property contains the regular expression. If the value of the property is null or an empty string (""), the value automatically passes validation for the RegularExpressionAttribute attribute. To validate that the value is not `null` or an empty string, use the **RequiredAttribute** attribute.
57-
58-
The regular expression searches for an exact match, not using `^` before and `$` at the end of the pattern produces the same results as using it. For a search hit, prepend and append the pattern with `.*`.
5956
57+
You apply the RegularExpressionAttribute attribute to a property when you need to validate values for the property against a regular expression. The regular expression enables you to specify very precisely the format of valid values. The Pattern property contains the regular expression. If the value of the property is null or an empty string (""), the value automatically passes validation for the RegularExpressionAttribute attribute. To validate that the value is not `null` or an empty string, use the **RequiredAttribute** attribute.
6058
59+
The regular expression searches for an exact match, not using `^` before and `$` at the end of the pattern produces the same results as using it. For a search hit, prepend and append the pattern with `.*`.
6160
6261
## Examples
63-
The following example shows how to use the <xref:System.ComponentModel.DataAnnotations.RegularExpressionAttribute> attribute to validate the FirstName and LastName data fields. The regular expression allows up to 40 uppercase and lowercase characters. The example performs the following tasks:
6462
63+
The following example shows how to use the <xref:System.ComponentModel.DataAnnotations.RegularExpressionAttribute> attribute to validate the FirstName and LastName data fields. The regular expression allows up to 40 uppercase and lowercase characters. The example performs the following tasks:
64+
6565
- Implements a metadata partial class and the associated metadata class.
66-
6766
- In the associated metadata class, applies the <xref:System.ComponentModel.DataAnnotations.RegularExpressionAttribute> attribute to the FirstName and LastName data fields, specifying the pattern and custom error messages.
6867
69-
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.ComponentModel.DataAnnotations.RegularExpressionAttribute/CS/Customer.cs" id="Snippet1":::
70-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.ComponentModel.DataAnnotations.RegularExpressionAttribute/VB/Customer.vb" id="Snippet1":::
68+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.ComponentModel.DataAnnotations.RegularExpressionAttribute/CS/Customer.cs" id="Snippet1":::
69+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.ComponentModel.DataAnnotations.RegularExpressionAttribute/VB/Customer.vb" id="Snippet1":::
7170
7271
]]></format>
7372
</remarks>
73+
<related type="Article" href="https://learn.microsoft.com/dotnet/standard/base-types/regular-expressions">.NET regular expressions</related>
7474
</Docs>
7575
<Members>
7676
<Member MemberName=".ctor">

0 commit comments

Comments
 (0)