JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js"></script>
<div data-ng-app="App">
<div data-ng-controller="Ctrl">
<p>Length is: {{string.length}}</p>
<p>String is valid: {{valid}}</p>
<input data-ng-model="string" />
</div>
</div>
JavaScript
var app = angular.module('App',[]);
app.controller('Ctrl', function($scope){
$scope.string = '';
$scope.regex = /^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]{5,})$/; //any sequence of 5 or more alphanumeric characters that contains at least one letter, and at least one number, no white-space
$scope.valid = false;
$scope.$watch('string', function(){
$scope.valid = $scope.regex.test($scope.string);
})
});