-1

我想让用户只添加像 123456.78912445、-12345.7777777899、1234567、-12345678 这样的数字。没有数量限制。我如何为这个 textformfield 编写 Regrex 模式。同样的问题inputFormatter 应该只允许十进制数和负数

TextFormField(inputFormatters:[FilteringTextInputFormatter.allow(RegExp())])
4

1 回答 1

0

尝试这个:^\-*\d+(?:.\d+)?$

例如:https ://regex101.com/r/yQDyoM/1

于 2021-09-07T13:54:45.170 回答