I have a string test in which I can see VD1 and VD2. How can I remove the value of VD1 and VD2 and store it in string.
string test = "Domain Name = xyz.zzz.com and Snshoditon = 03% 2f17% 2f2015 and VD1 = MTMwMDE3MDQ% 3d and VD2 = B67E48F6969E99A0BC2BEE0E240D2B5C and SiteLanguage = English"
the value here VD1 = MTMwMDE3MDQ% 3d
and VD2 = B67E48F6969E99A0BC2BEE0E240D2B5C
. But these are dynamic values here VD1 and VD2 are '& amp; Is separated from.
Try regex like this:
public static void main ( string [] Arges) exception {string test = "Domain Name = xyz.zzz.com and Snshoditon = 03% 2f17% 2f2015 and VD1 = MTMwMDE3MDQ% 3d and VD2 = B67E48F6969E99A0BC2BEE0E240D2B5C and Saitbhasha = English"; Pattern p = Pattern.compile ( "VD1 = (. *) And VD2 = (. *) And"); Mitcher M = P. Mettera (test); While (m.find ()) {System.out.println (m.group (1)); Println (m.group (2)); }}
MTMwMDE3MDQ% 3d B67E48F6969E99A0BC2BEE0E240D2B5C
No comments:
Post a Comment