the content is like this
some content and some 123 %b1% and also some content %b2% %b3%
and I want to match contents except %b1% or %b2% …
I tried
([^(?:%b\d+%)]+)
but digtal “123” will not be included.
how to matched the contents which NOT include “%b\d+” ?
thanks.
I think this is how it’s done in PHP:
If not, I’d be glad to hear what I’m doing wrong. In any case, I know the Ruby solution below works.
Original answer:
I wish I knew PHP better, but I’m sure it would be easy enough to figure out how to convert this Ruby code to PHP:
matchthen contains:The idea is to scan for all the matches of that regex,
/(?:^|(?!%b\d+%))(.*?)(?:%b\d+%|$)/, and concatenate them; I don’t know how PHP does that.