I have a string like:
string str = "https://abce/MyTest";
I want to check if the particular string starts with https:// and ends with /MyTest.
How can I acheive that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This regular expression:
will do what you ask.
^matches the beginning of the string.https://will match exactly that..*will match any number of characters (the*part) of any kind (the.part). If you want to make sure there is at least one character in the middle, use.+instead./MyTestmatches exactly that.$matches the end of the string.To verify the match, use:
More info at the MSDN Regex page.