정규식 - 비밀번호 검사
비밀번호 검사
by jinam yu
HTML
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div id="app">
<form class="p-4">
<div class="form-group">
<label for="exampleInputEmail1">대/소문자,숫자,특수문자 포함하여 8글자 이상 입력해 보세요.</label>
<input type="text" class="form-control" :class="(output)?'is-valid':'is-invalid'" v-model="password" />
</div>
</form>
</div>
CSS
html, body {
background-color: #f8f9fa;
}
Vue
new Vue({
el: "#app",
data: {
password: "aAzZ1!a_a",
},
computed: {
output() {
return /^.*(?=.{8,10})(?=.*[a-zA-Z])(?=.*?[A-Z])(?=.*\d)(?=.+?[\W|_])[a-zA-Z0-9!@#$%^&*()-_+={}\|\\\/]+$/g.test(this.password);
}
},
methods: {},
mounted() {}
})