I need to find « in a string with a regex. How would you add that into the following:
String RegExPattern = @"^[0-9a-df-su-z]+\.\s«";
Regex PatternRegex = new Regex(RegExPattern);
return (PatternRegex.Match(Source).Value);
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.
You should be able to simply use it directly:
Of course, if used alone you can also use
String.IndexOfinstead. If you want to use it in another pattern, as in your question, go ahead. The usage is correct.If, on the other hand, you also want to allow the named entity, use an alternation:
Once again, the same can be done in a more complex expression. The
?:at the beginning of the group isn’t necessary; it just prevents that a capture group will be created for this alternation.