c# - Regex match pattern inside a wrapping pattern -


I think & lt; & Lt; And >> Tag >> For the phone numbers, this regex:

  0 [2349] {1} \ - [1-9] {1} [0-9] {6}  < / Ex> 

I was tired of finding (? = (?::?); but it does not work for me

The following seems to work ():

  reggaex r = new reggae (@ "(? S)  gt; & gt; ");  

Each & lt; & Lt; ... & gt; & Gt; section is a match , and all phone numbers in that section

related questions


How Pattern is Formed

First of all, I have simplified your phone number pattern:

  0 [2349] - [1-9] [0-9] {6}  

That is, {1} is unnecessary, so they are thrown (see) .

Then, let's call each & lt; & Lt; . & Gt; & Gt; section. Let's start:

  (? S) & lt; & Lt; ((?! & Gt; & gt;).) * & Gt; & Gt;  

This is for each & lt; & Lt; .. & gt; & Gt; will match the section. To capture the body . * is safe from a negative look-up (?!?!!); so that we do not go out of bounds.

Then, instead of matching , we instead prefer to match your phone number. That is, we change the .

  (phonenumber |.)  

Then I just non-capturing a few groups, and the phone number to \ 1 and it is very much the fact that all captures made by any group in a match take NAT Ridge back to the rest.

Context

  • and

Comments