It's something simple but I can not understand it. I want to find a substrings with this regex. This match will be "M4N3M5", but will not be matched with:
const string text = "asdf m4n 3m5 adsf"; Reggae Regex = New Reggae ("[[ABCEGHJKLMNPRSTVXY] {1} \ d {1} [AZ] {1} * \ d {1} [Edge] {1} \ d {1} $", Reggae option no .; Match match = regex.Match (text); string value = match. Value;
^ And try to delete $:
Regex Regex = New Regex (@ "[ABCGJJLMNPRTVXI] {1} \ D {1} [AGED] {1} * \ D {1} [ Aged] {1} \ D {1} ", Regex option.); - ^: The match must start with the beginning of the string or line. < Li> $: Match string At the end or before the \ N line or end of the string.
If you want to match only the word boundaries, then you can use \ b suggested by Mike Strobeel :
Reggae Regex = New Regex (@ "\ b [abcEGeHJKLMNPRTVXI] {1} \ D {1} [ed] {1} * \ D {1} [ed] {1} \ D {1} \ B ", RegexOptions.None);
No comments:
Post a Comment