Hi,
How can I get the string between %(%variable_provinces%) from below string using regex
已委托乙方作为其产品在%variable_provinces% sts ssthshi ing 123123
Hi,
How can I get the string between %(%variable_provinces%) from below string using regex
已委托乙方作为其产品在%variable_provinces% sts ssthshi ing 123123
HI @Liwq
You can try with Regex expression
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=%).*(?=%)").Tostring
Regards
Gokul
Hi @Liwq
If you need with % symbol try with this expression
System.Text.RegularExpressions.Regex.Match(YourString,"(?=%).*(?<=%)").Tostring
@Gokul001 thanks for your reply, I have mutiple lines like below, how can get three items
%variable_yifang%(简称:乙方)
签署的《协议》(以下称“”)已委托乙方作为其产品在%variable_provinces%(省/直辖市/自治区)(
网络优势扩大甲方产订%variable_year%年一级经销商商业政策
Hi @Liwq
Try with Matches
System.Text.RegularExpressions.Regex.Matches(YourString,"(?=%).*(?<=%)")(0)
(0) -> Will get the first occurrences.
(1) -> Will get the Second Occurrence
Regards
Gokul
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.