Input pattern regex doesn't work anymore after update

Looks like after update to Ionic 2.1.18 input pattern seems to be broken:
This part worked for me before but now Password.valid is always false:

  <ion-item>
    <ion-label floating>Password*</ion-label>
    <ion-input type="password" required [(ngModel)]="regModel.Password" name="Password"
               #Password="ngModel" pattern="^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d*\w]{5,}$"
               (change)="checkPassword()"></ion-input>
  </ion-item>
  <ion-item no-border no-lines no-margin *ngIf="!Password.valid && Password.dirty" color="danger">
    <small>Five characters minimum,</small>
    <br>
    <small> at least 1 uppercase, 1 lowercase and 1 number {{Password.valid}} {{Password.dirty}}
    </small>
  </ion-item>

Pattern is not a valid @Input() for ion-input, so that makes sense it wouldn’t work.

You should use formBuilder API instead for better control and validation.

1 Like

Hi, thank you for response. [quote=“mhartington, post:2, topic:75790”]
Pattern is not a valid @Input() for ion-input, so that makes sense it wouldn’t work.
[/quote]
Could you explain this moment for me, please? The problem is that common pattern validation gave a lot of benefits out of the box, such as localized popover messages. E.g., one of my fields
>

        <ion-label floating>Email*</ion-label>
        <ion-input type="email" required [(ngModel)]="regModel.Emails[0].Email" name="Email" #Email="ngModel"
                   (change)="checkEmail()"></ion-input>
      </ion-item>
      <ion-item no-border no-lines no-margin *ngIf="!Email.valid && Email.dirty" color="danger">
        <small>Email is required.</small>
</ion-item>

Additionally to my warning( which is completely broken because of email validation regexp) user received popover message about proper way to fill email field. This message was based on the device language which was convenience approach for me. Could you provide link with about on which version pattern became deprecated and broken and/or about how to build such behaviour on my own?

Update
My bad, email validation seems to work. And funny thing some of simple regular expressions work fine, but another - don’t, e.g. [a-zA-Z ]* - works fine, \d{5} - don’t