[总结]工作中常用的正则表达式,有了它事半功倍!
1.给现有的DropDownList添加项目!
例如:
文档中有如下信息
1 Own Home Outright
2 Buying Home
3 Living with Relatives or Friends
4 Leasing/Rent
5 Departement housing
6 Aboriginal housing
那么用正则表达式
例如:
<asp:DropDownList id="ddlF1127" runat="server">
</asp:DropDownList>
</asp:DropDownList>
文档中有如下信息
1 Own Home Outright
2 Buying Home
3 Living with Relatives or Friends
4 Leasing/Rent
5 Departement housing
6 Aboriginal housing
那么用正则表达式
{:z} {[a-zA-Z:Zs\/]+}
<asp:ListItem Value =\1>\2</asp:ListItem>
可以替换为<asp:ListItem Value =\1>\2</asp:ListItem>
<asp:DropDownList id="ddlF1127" runat="server">
<asp:ListItem Value="1">Own Home Outright </asp:ListItem>
<asp:ListItem Value="2">Buying Home </asp:ListItem>
<asp:ListItem Value="3">Living with Relatives or Friends</asp:ListItem>
<asp:ListItem Value="4">Leasing/Rent</asp:ListItem>
<asp:ListItem Value="5">Departement housing</asp:ListItem>
<asp:ListItem Value="6">Aboriginal housing</asp:ListItem>
</asp:DropDownList>
<asp:ListItem Value="1">Own Home Outright </asp:ListItem>
<asp:ListItem Value="2">Buying Home </asp:ListItem>
<asp:ListItem Value="3">Living with Relatives or Friends</asp:ListItem>
<asp:ListItem Value="4">Leasing/Rent</asp:ListItem>
<asp:ListItem Value="5">Departement housing</asp:ListItem>
<asp:ListItem Value="6">Aboriginal housing</asp:ListItem>
</asp:DropDownList>