Click here to Skip to main content
15,913,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please help me to fetch particular values from a string .
String is in format gine below ,

string s =
(Noshow=Ads|Attract=
N\\013\\abc.swf;
N\\012\\def.jpg)

i want to fetch only abc.swf and def.jpg .

Anyone can suggest me a regex to fetch value between "\\" and ";" or any other way .
Posted

This seems to work (in .net): (?<=\\\\)[^;\\\)]*?(?=;|\))

http://msdn.microsoft.com/en-us/library/az24scfc.aspx[^]
 
Share this answer
 
v2
You can try this:-

C#
string text = "(Noshow=Ads|Attract=N\\013\\abc.swf;N\\012\\def.jpg"; //Put your string
string answerStr = myString .Split('\\', ';')[1];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900