Home > Net >  angular reactive form contain field which is localpath which allow atleast two slashes in regex what
angular reactive form contain field which is localpath which allow atleast two slashes in regex what

Time:12-29

i have tried my reg exp but it is not working please help to regex having atleast two slashes

`<div
  
  *ngIf="dropboxForm.get('localPath')?.hasError('pattern')"
>
  <p>special characters allowed</p>
</div>`

ts file

localPath: new FormControl('', [ Validators.required, Validators.pattern('^[a-zA-Z ][/]{2,} $'), ]),

CodePudding user response:

What are you trying to validate? please add more information about it.

CodePudding user response:

In your .ts file, Use escape character '\' for '/' as ^[a-zA-Z ][\/]{2,} $

  • Related