.net - Probably simple regex search -
what regex find text#2? pattern it's first occurance of "z=" after c. text want rest of line after z=. i'm using regex in .net
a x b x z=text#1 x c x z=text#2
.*c.*z=([^\n]*).*
you'll need turn on .
matching newlines (regexoptions.singleline
below).
here's c# code generated my regex tester:
using system; using system.text.regularexpressions; namespace myapp { class class1 { static void main(string[] args) { string sourcestring = "source string match pattern"; regex re = new regex(@".*c.*z=([^\n]*).*",regexoptions.singleline); matchcollection mc = re.matches(sourcestring); int midx=0; foreach (match m in mc) { (int gidx = 0; gidx < m.groups.count; gidx++) { console.writeline("[{0}][{1}] = {2}", midx, re.getgroupnames()[gidx], m.groups[gidx].value); } midx++; } } } }
very informative blog and useful article thank you for sharing with us , keep posting Ruby on Rails Online Course
ReplyDelete