c# - Regex skipping matches -


i trying select multiple matches in string looks like:

123
blah
end
45
blah
end

ideally return 2 matches of starting digit sequence , ending end string. using following:

regex splitter = new regex(@"^\d{2,3}(.*)end", regexoptions.singleline); foreach (match res in splitter.matches(content)) {    console.writeline(res.tostring()); } 

however above pattern returning entire input string in 1 match. have feeling 'singleline' option. doing wrong?

change * quantifier lazy form (with (.*?) syntax). @ moment attempts match many symbols in string possible - , succeeds in doing that, of course, have several blocks ending end.

with ? added, engine attempt match pattern few symbols possible, finishing (.*?) match right before first end encounters.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -