1

follow string must be match

das is<C strike ><c1>t ein text </c1></C><C u ><c1>der </c1></C><C b u ><c1>hier </c1></C>im <C i u ><c1>editor </c1></C><u></u>steht

my regex don't work

>(.*?)<

thats match all text between tags, but i need only follow result, for my it's only the text interested was no warp from any TAG (for this sample like )

match[0] ------> das is
match[1] ------> im 
match[2] ------> steht

but i become this:

match[0] ------> das is
match[1] ------> t ein text 
match[2] ------> der 
match[3] ------> hier 
match[4] ------> im 
match[5] ------> editor 
match[6] ------> steht
Nico
  • 27
  • 1
  • 4
  • Sorry, but I can't imagine anyone would understand what you are trying to achieve. Please ask a colleague to form proper English sentences so that we can get an idea of what you are talking about. Btw, you might want to grab some kind of learning-english-book, since even a german programmer should be able to get the basics of the english language ;-) Nur ein kleiner Tipp – Vince Oct 01 '13 at 08:18

1 Answers1

0

I suggested this regex in another question, I guess this however fits your case perfectly:

(?:(?![^<>]*(?:>))[^<])+

regex101 demo

Use preg_match_all by the way.

EDIT: You can try this:

([^<>]+)(<[^>]+>(?:[^<>]*|(?2))</[^>]+>)*

viper-7 demo

Or another regex:

(?:(?![^<>]*(?:>))[^<](?![^<>]*</))+
Community
  • 1
  • 1
Jerry
  • 70,495
  • 13
  • 100
  • 144
  • nearly :) your regex match all text between TAGs, but i need only the text which no wrap from tag's, specifically in this case are this follow strings match[0] ------> das is match[1] ------> im match[2] ------> steht – Nico Oct 01 '13 at 08:30
  • yes it's right... with this regex i can better to wrap the matched strings – Nico Oct 01 '13 at 10:03
  • @ jerry it's possible to write you a e-mail because i have a "sensitive sourcecode" (less 5 lines - I do not want to publish the source code) ... Topic is: regex – Nico Oct 01 '13 at 10:10
  • @ jerry no, its works all fine :) but i have a source-code ... I would like that (only) you to recheck code. (less 5 lines) (I do not publish this on the internet ;) – Nico Oct 01 '13 at 10:20
  • @Nico Well, I guess you can send me an email. This should be visible in my StackOverflow profile I think. – Jerry Oct 01 '13 at 10:22
  • ok, i try to write you a messeag over your deviantart website – Nico Oct 01 '13 at 10:30