How to allow single quote in regular expression for WhitelistingTextInputFormatter?

Viewed 333

I have a TextField for username and want to include single quote (') within the characters such as (O'Neal Nickel). Here is my regular expression for allowing letters, space, full stop (.), hyphens (-), and single quote (').

WhitelistingTextInputFormatter(RegExp('[a-zA-Z0-9 \'.-]'))

The regex is working for Android but not for iOS. In iOS, the TextField is not allowing single quotes. Did I get the regex right?

0 Answers
Related