regexflutterdart

Accept single quote and double quote for password validation in flutter


I want to accept both quotes (',") in a password field validation, but my regex isn't functioning. I've tried a lot of regular expression patterns, but it doesn't work. Could you possibly help me?

I've used both regex:

Example string:

String password = """@Ado'da"foewa""";

These are the conditions I would like to have:


Solution

  • You can use multiline string: '''my string'''

    Try: RegExp(r'''^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*['"!@#\$&*~:;!?/()+\-\\\$[\]{}|/?>.<,::~^&*()_+=-]).{8,}$''');

    You forgot a number in this example:

    String password = """@Ado'da"foewa""";