Extract string from a String in c# -


how can this:

mu6aquvx/ywxpymfkote5kycrmzjaz21hawwuy29t/?app_redirect=false" 

from link:

https://facebook.com/accounts/confirm_email/mu6aquvx/ywxpymfkote5kycrmzjaz21hawwuy29t/?app_redirect=false"  

extracting string:?

#039;ll see posts in feed.</p></td></tr><tr style=""><td height="30" style="line-height:30px;" colspan="1">&nbsp;</td></tr><tr><td style=""><a href="https://facebook.com/accounts/confirm_email/mu6aquvx/ywxpymfkote5kycrmzjaz21hawwuy29t/?app_redirect=false" style="color:#3b5998;text-decoration:none;display:block;width:370px;"><table border="0" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse;"><tr> 

you can use below function string between 2 words:

public static string gettextbetween(string source, string leftword, string rightword)         {             return                 regex.match(source, string.format(@"{0}\s(?<words>[\w\s]+)\s{1}", leftword, rightword),                             regexoptions.ignorecase).groups["words"].value;         } 

call below function arguments:

gettextbetween("your full text search from", "start fix text", "end fix text")


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -