Dear All,
How to write a regular expression to check % within [ and ]
Thanks,
Regular expression to check % within [ and ]
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rakesh Jha85 reputationPosted Sep 27, 2011, 4:38 AM EDT
/(\[\w*?\d*?[%]\w*?\d*?\])/gi
you can put any thing according to your requirement in place of (\d & \w).
Pravin MoreRank #1,419 · 1.2K reputationPosted Sep 27, 2011, 4:47 AM EDT
try like this..............
Regex regex = new Regex(@"[(?%:32|10|13)]");
Match m=regex.Match("%");
MessageBox.Show(m.ToString());
Thanx,Hope it will help you.
Pravin.
VulpesRank #55 · 29.2K reputationPosted Sep 27, 2011, 9:55 AM EDT
string regExp = @"\[[^]]*%.*?]";