Принять все специальные символы в iOS [duplicate]

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == android.R.id.home) {
        onBackPressed();
        return true;
    }
    //noinspection SimplifiableIfStatement
    if (id == R.id.signIn) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}
///////////////////
@Override
public void onBackPressed() {
    super.onBackPressed();
    finish();
}
9
задан halfer 24 September 2017 в 23:09
поделиться

4 ответа

Регулярное выражение

(?:(?:(?=.*?[0-9])(?=.*?[-!@#$%&*ˆ+=_])|(?:(?=.*?[0-9])|(?=.*?[A-Z])|(?=.*?[-!@#$%&*ˆ+=_])))|(?=.*?[a-z])(?=.*?[0-9])(?=.*?[-!@#$%&*ˆ+=_]))[A-Za-z0-9-!@#$%&*ˆ+=_]{6,15}
4
ответ дан Vaibhav Jhaveri 17 August 2018 в 09:57
поделиться

Вы можете использовать Regex для проверки вашей проверки силы пароля

^(?=.*[A-Z].*[A-Z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8}$

Regex Пояснение: -

^                         Start anchor
(?=.*[A-Z].*[A-Z])        Ensure string has two uppercase letters.
(?=.*[!@#$&*])            Ensure string has one special case letter.
(?=.*[0-9].*[0-9])        Ensure string has two digits.
(?=.*[a-z].*[a-z].*[a-z]) Ensure string has three lowercase letters.
.{8}                      Ensure string is of length 8.
$                         End anchor.

Источник - Rublar Link

29
ответ дан Anand Nimje 17 August 2018 в 09:57
поделиться

попробуйте использовать этот пароль для пароля, который должен содержать более 6 символов с по крайней мере одним столичным, цифровым или специальным символом

^.*(?=.{6,})(?=.*[A-Z])(?=.*[a-zA-Z])(?=.*\\d)|(?=.*[!#$%&? "]).*$

^ assert position at start of the string
.* matches any character (except newline)
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
(?=.{6,}) Positive Lookahead - Assert that the regex below can be matched
.{6,} matches any character (except newline)
Quantifier: {6,} Between 6 and unlimited times, as many times as possible, giving back as needed [greedy]
(?=.*[A-Z]) Positive Lookahead - Assert that the regex below can be matched
.* matches any character (except newline)
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
[A-Z] match a single character present in the list below
A-Z a single character in the range between A and Z (case sensitive)
(?=.*[a-zA-Z]) Positive Lookahead - Assert that the regex below can be matched
.* matches any character (except newline)
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
[a-zA-Z] match a single character present in the list below
a-z a single character in the range between a and z (case sensitive)
A-Z a single character in the range between A and Z (case sensitive)
(?=.*\\d) Positive Lookahead - Assert that the regex below can be matched
.* matches any character (except newline)
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
\d match a digit [0-9]
2nd Alternative: (?=.*[!#$%&? "]).*$
(?=.*[!#$%&? "]) Positive Lookahead - Assert that the regex below can be matched
.* matches any character (except newline)
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
[!#$%&? "] match a single character present in the list below
!#$%&? " a single character in the list !#$%&? " literally (case sensitive)
.* matches any character (except newline)
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
$ assert position at end of the string

https : //regex101.com/#javascript

больше этого вы можете попробовать ....

Минимум 8 символов не менее 1 Алфавит и 1 номер:

"^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$"

Минимум 8 символов не менее 1 Алфавит, 1 Номер и 1 Специальный символ:

"^(?=.*[A-Za-z])(?=.*\\d)(?=.*[$@$!%*#?&])[A-Za-z\\d$@$!%*#?&]{8,}$"

Минимум 8 символов не менее 1 Аппер-алфавит, 1 алфавит нижнего регистра и 1 номер:

"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{8,}$"

Минимум 8 символов не менее 1 Аппер-алфавитный алфавит, 1 алфавит нижнего регистра, 1 номер и 1 специальный символ:

"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[d$@$!%*?&#])[A-Za-z\\dd$@$!%*?&#]{8,}"

Минимум 8 и максимум 10 символов не менее 1 Апгрейд-алфавит, 1 строчный алфавит, 1 номер и 1 специальный символ:

"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&#])[A-Za-z\\d$@$!%*?&#]{8,10}"
21
ответ дан Jayprakash Dubey 17 August 2018 в 09:57
поделиться
  • 1
    Что об этом: пароль должен быть более 6 символов, при этом не менее одного капитала, числового или специального символа – Vaibhav Jhaveri 2 September 2016 в 06:26
  • 2
    . ^ * (? = {6}.) (= * [AZ]?.) (= * [A-Za-Z]?.) (= * \ D?.) |? (= * [.! # $% & amp ;? & quot;]). * $ – Nazmul Hasan 2 September 2016 в 07:51
public func isValidPassword() -> Bool {
    let passwordRegex = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z!@#$%^&*()\\-_=+{}|?>.<,:;~`’]{8,}$"
    return NSPredicate(format: "SELF MATCHES %@", passwordRegex).evaluate(with: self)
}

Если вам нужно быстрое исправление. Это проверка пароля с регулярным выражением. Скопируйте / вставьте файл помощника или расширения и используйте его.

3
ответ дан Wiktor Stribiżew 17 August 2018 в 09:57
поделиться
  • 1
    - внутри класса символов создает диапазон, вам следует избегать его. Я отредактировал ответ. – Wiktor Stribiżew 4 May 2018 в 09:18
  • 2
    Нет проблем, tnx bro. – Psajho Nub 4 May 2018 в 09:54
Другие вопросы по тегам:

Похожие вопросы: