考虑以下字符串,我想替换包含带空格的字母的括号:
str = (abc pqr xyz (tttt) 2018(2))
我期待以下输出:
str_op = abc pqr xyz tttt 2018(2)
如何编写上述示例的正则表达式
答案 0 :(得分:1)
@{
ViewBag.Title = "Index";
Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
<link href="~/Assets/Styles/Admin/bootstrap.min.css" rel="stylesheet" />
<link href="~/Assets/Styles/Admin/HomeIndexStyle.css" rel="stylesheet" />
<script src="~/Assets/Js/jquery-1.11.3.min.js"></script>
<script src="~/Assets/Js/jquery-1.11.3.js"></script>
}
@model List<Model.ADO.M_STUDENT>
@using(@Html.BeginForm()) {
@Html.DropDownList("paging", new List<SelectListItem> {
new SelectListItem{Text="1",Value="1"},
new SelectListItem{Text="5",Value="5",Selected=true},
new SelectListItem{Text="10",Value="10"}
}, new { onchange = @"form.submit();"})
}
@{
var webGird = new WebGrid(
Model, rowsPerPage: ViewBag.rowsPerPage,
defaultSort: "Update_At",
columnNames: new[] { "ID", "Name", "Address", "Email", "Phone", "Status", "Update_By", "Update_At" }
);
webGird.SortDirection = SortDirection.Descending;
@webGird.GetHtml(tableStyle: "table table-bordered table-hover table-striped")
}
您可以使用它并替换为(\([^\D]*\))|\(|\)
。请参阅演示。