我一直在尝试制作一个匹配具有以下特征的密码的正则表达式:
密码无效的示例
有效密码示例
BTW:这是我实际使用的正则表达式,但是不匹配连续的字符。
regex:/^(?=.*[a-z|A-Z]\1{1})(?=.*[A-Z])(?=.*\d).+$/
谢谢大家。
答案 0 :(得分:2)
您可以将此正则表达式用于满足您的所有要求:
import UIKit
import AVFoundation
import AVKit
let playerViewControllerSegue = "play";
class MyViewController: UIViewController {
@IBAction func playMovie(sender: UIButton) {
self.performSegueWithIdentifier(playerViewControllerSegue, sender: self);
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == playerViewControllerSegue){
let path = NSBundle.mainBundle().pathForResource("7second", ofType:"mp4")!
let videoURL = NSURL(fileURLWithPath: path)
let player = AVPlayer(URL: videoURL)
let playerViewController = segue.destinationViewController as! AVPlayerViewController
playerViewController.player = player
playerViewController.player?.play()
}
}
}
这是正则表达式分手:
^(?=.*[A-Z])(?=.*[aAeEiIoOuU])(?=.*\d)(?:([a-zA-Z\d])(?!\1))+$
答案 1 :(得分:1)
^(?=.*[aeiouAEIOU])(?=.*[A-Z])(?=.*\d)(?!.*(.)\1)[a-zA-Z0-9]+$
你可以使用它。参见演示。