Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <regex>
- using namespace std;
- int main(){
- //(?=.)
- //string brojevi = "(?=.*[0-9])";
- //string mslova = "(?=.*[a-z])";
- //string vslova = "(?=.*[A-Z])";
- //string specijalni = "(?=.*[@#$%])";
- //string minimalno = "(?=.{7,})";
- //string pravilo = mslova + vslova + brojevi + specijalni+ minimalno;
- //telefonski broj
- // +387 (33) 222 333
- //string unos;
- //string pravilo = "(\\+)?([0-9]{3})(\\()?([0-9]{2})(\\))?([- ])?([0-9]{3})([- ])?([0-9]{3})";
- //(\\d{2})
- string ime;
- string prezime;
- string password;
- string brojevi = "(?=.*[0-9])";
- string mslova = "(?=.*[a-z])";
- string vslova = "(?=.*[A-Z])";
- string specijalni = "(?=.*[@#$%*]{1,})";
- string minimalno = "(?=.{7,})";
- cout << " ime: ";
- getline(cin, ime);
- cout << " prezime: ";
- getline(cin, prezime);
- do{
- cout << "password: ";
- getline(cin, password);
- string pravilo = brojevi + mslova + vslova + specijalni + minimalno;
- if (regex_search(password, regex(pravilo))){
- pravilo = "(?:(" + ime + "|" + prezime + "))";
- if (!regex_search(password, regex(pravilo))){
- cout << " OK " << endl;
- }
- }
- cout << "---------------------------------------\n";
- } while (password!="exit");
- system("pause > null");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement