Can somebody help me to get a content between [%= and %].
Share
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.
If there cannot be nested tags you can use the following regex:
The symbols mean the following:
\[ Match a literal [ character. The backslash is required otherwise [ would start a character class. %= Match %= (.*?) Match any characters, non-greedy. i.e. as few as possible. The parentheses capture the match so that you can refer to it later. %] Match %] - Note that it is not necessary to escape ] here, but you can if you want.Here’s how you could use it in C#:
Output:
Or to get multiple matches:
Output:
Note the string literal is written as @”…”. This means that the backslashes inside the string are treated as literal backslashes, and not escape codes. This is often useful when writing regular expressions in C#, to avoid having to double up all the backslashes inside the string. Here it doesn’t make much difference, but in more complex examples it will help more.