I have an array of objects with each object having details of the input field which has to be generated dynamically, I have done the dynamical input field generation based on the type received from API, but I'm not able to match the regular expression.
<ng-container *ngFor="let list of inputList">
<label>{{list.key}}</label>
<input [type]="list.type" [value]="list.value" [required]="list.required" [pattern]="list.regex" (input)="valueChange($event)" />
</ng-container>
Api response inputList
[{key: "Name", type: "text", value: "", required: true, mandatory: false, regex: [A-Z][a-z]$}
{key: "Number", type: "number", value: "", required: true, mandatory: false, regex: [0-9]{10}$}
{key: "description", type: "textarea", value: "", required: true, mandatory: false, regex: [a-z]{10,250}}
{key: "email", type: "text", value: "", required: true, mandatory: false, regex: /\S+@\S+\.\S+/}];
However the pattern is not working is there any alternative only to accept these inputs from keyboard, for example in case of mobile user should not be able to type other keys except number.