在颤振中使用正则表达式分割时如何保留分隔符?
文本:"this is {{A}} sample {{text}} ..."
"this is {{A}} sample {{text}} ..."
我想要的是:["this is", "{{A}}", "sample", "{{text}}", "..."]
["this is", "{{A}}", "sample", "{{text}}", "..."]
我使用了以下正则表达式,
"this is {{A}} sample {{text}} ...".split(RegExp("{{(.*?)}}"))
并得到,["this is ", " sample ", " ..."]
["this is ", " sample ", " ..."]
regex dart flutter
dart ×1
flutter ×1
regex ×1