DEV Community

Pawan
Pawan

Posted on

Pattern(/^[^+%{}~?^:#!|=*;,\[\]<>"'`\¿\-]*$/) not accepting chars x,f,b on prod build while working on dev build for Validators

I have Angular project with the following pattern with a file app.component.ts which is like as follows and I'm using angular validator version "@angular/forms": "^14.2.0" :

import { FormBuilder, FormGroup, Validators } from '@angular/forms';

 [
          Validators.required,
          Validators.pattern(/^[^+%{}~?^:#!|=*;,\[\]<>"'`\¿\-]*$/),
          Validators.maxLength(64)
        ]
Enter fullscreen mode Exit fullscreen mode

And my html file as app.component.html :

<form [formGroup]="myForm">
  <label for="name">Name:</label>
  <input type="text" id="name" formControlName="name" />

  <div *ngIf="myForm.get('name')?.hasError('required')">
    Name is required.
  </div>

  <div *ngIf="myForm.get('name')?.hasError('pattern')">
    Invalid characters in the name.
  </div>

  <div *ngIf="myForm.get('name')?.hasError('maxlength')">
    Name should not exceed 64 characters.
  </div>
</form>
Enter fullscreen mode Exit fullscreen mode

Kindly let me know why this pattern is not accepting x,f,b on production build while same is working on dev build for validator framework

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs