我需要一个简单的正则表达式,它将删除逗号后的所有换行符。知道我正在做的是删除所有
\n/g
我需要添加什么才能在逗号后删除? 感谢。
答案 0 :(得分:4)
使用
echo ExportMenu::widget([
'columnBatchToggleSettings'=>['label'=>'Alle Wählen'],
'dropdownOptions' =>
[
'label' => 'Exportieren',
'class' => 'btn btn-wkm'
],
'columnSelectorOptions'=>
[
'label' => 'Exportspalten',
'class' => 'btn btn-default dropdown-toggle',
'scrollable'=> true,
],
'columnSelectorMenuOptions' =>
[
'class' => 'dropdown-menu scrollable-menu',
'role'=> 'menu'
],
'dataProvider' => $dataProviderClone,
'columns' => $gridColumns,
'exportConfig' =>
[
ExportMenu::FORMAT_TEXT => false,
ExportMenu::FORMAT_HTML => false,
ExportMenu::FORMAT_EXCEL => false,
ExportMenu::FORMAT_PDF => false,
ExportMenu::FORMAT_EXCEL_X =>
[
'label' => 'EXCEL',
]
],
'container'=>['class'=>'btn-group pull-left', 'style'=> 'margin: 5px']
]);
例如
replace(/,\n/g,"")
答案 1 :(得分:3)
这很简单。试试这个:
/,\n+/g
完整代码:
var str = "first line,\nsecond line,\nalso, it is third line,\nand fourth line";
str = str.replace(/,\n+/g, ',');