为什么这个regexp不返回任何匹配项?
我正在使用一个,并试图找到一个 Dart代码:为什么这个regexp不返回任何匹配项?,regex,case-insensitive,dart,Regex,Case Insensitive,Dart,我正在使用一个,并试图找到一个 Dart代码: /pattern/flags语法可以在JavaScript中使用,但不能在Dart中使用,因为Dart没有正则表达式文本。相反,文档显示: const RegExp(String pattern, [bool multiLine, bool ignoreCase]) 因此,您的构造函数应该如下所示: RegExp exp = const RegExp("my", ignoreCase: true); 即使在JavaScript中,当使用RegE
/pattern/flags语法可以在JavaScript中使用,但不能在Dart中使用,因为Dart没有正则表达式文本。相反,文档显示:
const RegExp(String pattern, [bool multiLine, bool ignoreCase])
因此,您的构造函数应该如下所示:
RegExp exp = const RegExp("my", ignoreCase: true);
即使在JavaScript中,当使用
RegExp
构造函数时,它也必须是RegExp(“my”)
。
const RegExp(String pattern, [bool multiLine, bool ignoreCase])
RegExp exp = const RegExp("my", ignoreCase: true);