飞镖颤振
我需要正则表达式来知道一个字符串变量是否包含超过一个相同的输入。
我想要处理它的输入(- _ .)
我不会被重复不止一次的输入是-或者。或
假设用户编写了Alex.9 ..。这听起来很好,因为他写了一个点--我已经知道如何处理了,万一两个点在一起,就像Alex..9一样使用contains('..'),但是如果这两个点不是像A.le.x这样的相邻点,结果将是false
我不想要什么,好吗,:=
Alex.9 => ok
A.le.x => no
Alex-9 => ok
A-le-x9 => no
Alex_9 => ok
Al_e_x9 => no
// also if there was two or the whole difference of (- _ .) in the same string. like
A.le-x => no
A.le_x => no
A-l_9 => no
A.l-x_9 => no样本--我指的是
final TextEditingController nameController = TextEditingController();
Scaffold(
body: nameController.text.contains(RegExp('Is - or _ or . duplicated?'))?
Text('yes duplicated') : Text('not duplicated'),
);发布于 2021-12-28 03:00:18
正则表达式:[._-](.*[._-])+
https://stackoverflow.com/questions/70502243
复制相似问题