---
title: "正则表达式验证 password"
author: "夜鸣猪"
date: "2012-08-23T23:14:38Z"
tags: []
categories: ["编程语言"]
slug: "password"
draft: false
lastmod: "2012-08-23T23:14:38Z"
id: 1660724
url: "https://hlee.iteye.com/blog/1660724"
---

```ruby

#口令要求，必须包含大写或者小写
#必须包含数字
#总共8到40
 /^(?=.*\d)(?=.*([a-z]|[a-z]))([\x20-\x7e]){8,40}$/

```