From 98a617e415ff1b39d167ff4eae0141ba8b8dc3ef Mon Sep 17 00:00:00 2001 From: jnizet Date: Sun, 9 Dec 2018 10:18:11 +0100 Subject: [PATCH] docs(forms): clarify the pattern validator behavior (#27560) PR Close #27560 --- packages/forms/src/validators.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/forms/src/validators.ts b/packages/forms/src/validators.ts index aa742aeea2..2dffd4a43d 100644 --- a/packages/forms/src/validators.ts +++ b/packages/forms/src/validators.ts @@ -273,8 +273,12 @@ export class Validators { /** * @description * Validator that requires the control's value to match a regex pattern. This validator is also - * provided - * by default if you use the HTML5 `pattern` attribute. + * provided by default if you use the HTML5 `pattern` attribute. + * + * Note that if a Regexp is provided, the Regexp is used as is to test the values. On the other + * hand, if a string is passed, the `^` character is prepended and the `$` character is + * appended to the provided string (if not already present), and the resulting regular + * expression is used to test the values. * * @usageNotes *