'Mathematical optimization such as CVXPY, Gurobi, PuLP in Android Studio
How can I execute a Python-based CVXPY / Gurobi / PuLP optimization solver in Android Studio locally?
Solution 1:[1]
A - has different meanings in a character class depending on its position
At the end or at the start it's a literal: [._-] contains the three literals ., _ and -
Somewhere else, it's a range: [.-_] is a range from . to _.
You can use 4 regexes to check the strings
function check(str) {
return /^[a-zA-Z0-9._-]+$/.test(str) && /[a-zA-Z]/.test(str) && /[0-9]/.test(str) && /[._-]/.test(str);
}
const str1 = 'aA5.-_';
console.log(check(str1));
const str2 = 'aA5';
console.log(check(str2));
const str3 = 'aA5.-_+';
console.log(check(str3));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
