How to add a condition where if the first character is 4 then 16 digits and if 3 then 15 digits?
this is what i tried so far:
<ion-input
ngModel name="CNumber"
required
(ionChange)="C_number($event.target.value)"
(ionInput)="C_number($event.target.value)"
maxlength="{{Maxlength}}"
type="tel"
pattern="^(4)[0-9]{15}$"
>
^(4)[0-9]{15}
this will accept if the first is 4 and allows 16 characters, but how to add starting digit 3 and when so it accepts 15 characters only?