nested - Within same regex expression , performing multiple regex operations -


how can perform new regex operation regex group , within same regex expression ? "nested regex operations maybe?"

greetings , kind of understand how regex works havent been able perform operation yet using regex , can c# combined regex.

as in example.

"the quick 1234brown fox jumps on lazy 1234dog"

the regex (quick 1234brown fox jumps on lazy) yields "quick 1234brown fox jumps on lazy"

and im looking "1234" . first result. using regex (1234) "quick 1234brown fox jumps on lazy" return "1234".


in c# im able make work using regex multiple times.

    string test_string = "the quick 1234brown fox jumps on lazy 1234dog";     string clipped_text = "";     string end_result = "";      var match = regex.match(test_string, "quick 1234brown fox jumps on lazy", regexoptions.singleline);     if (match.success)     {         clipped_text = match.value;          match = regex.match(clipped_text, "1234", regexoptions.singleline);         if (match.success)             end_result = match.value;     } 

i want same thing 1 regex expression. of course , example simple , can done /w .* [] etc, other basic regex rules. had simplify example down level , in order clear answer. assuming above c# example regexes again , face situations need regex result multiple times more . comes being c# programmer , im not familiar regex yet im learning. in confusion , got stuck , cant go further tutorials without frying brain. how solve in nested regexes way appreciated, thank !

from description sounds need use backreference construct

backreference construct :msdn

there examples in linked page. using can refer repeated occurrences of substring within string.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -