'How to match special character like ` ," ,[] in flutter

When using Special Character in Regex, I faced some problem. In some special characters, ', ",[] the \\(special character) is not working. When I logged case by case, the special character was problem. Is there any one who know about this? My regex is below

  // ' " cannot insert this characters

  RegExp specialCharReg= RegExp(r'[~!@#$%^&*()_+`{}|<>?;:./,=\-[]]');

  RegExp passwordReg = RegExp(
      r'^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`{}|<>?;:./,=\-[]])[a-zA-Z\d~!@#$%^&*()_+`{}|<>?;:./,=\-[]]{8,20}$');

input : ghktkl12! , ghktkl12] 
both are not working in specialCharReg, because of [] in regexp



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source