Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5847781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:46:01+00:00 2026-05-22T12:46:01+00:00

the content is like this some content and some 123 %b1% and also some

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:46:02+00:00Added an answer on May 22, 2026 at 12:46 pm

    I think this is how it’s done in PHP:

    $str = "some content and some 123 %b1% and also some content %b2% %b3%";
    $pattern = '/(?:^|(?!%b\d+%))(.*?)(?:%b\d+%|$)/';
    preg_match_all($pattern, $str, $matches);
    $match = implode($matches[0]);
    

    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:

    str = "some content and some 123 %b1% and also some content %b2% %b3%"
    match = str.scan(/(?:^|(?!%b\d+%))(.*?)(?:%b\d+%|$)/).join
    

    match then contains:

    "some content and some 123  and also some content  "
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to do something like this: For some reason the ImageView is not
I have some content like this: author = Marjan Mernik and Viljem Zumer, title
I'm loading in some HTML content like this: $('#scores').load('scores.php #scores'); Note that It is
I am scraping some website content which is like this - Company Stock Rs.
I have some code like this: var content = document.getElementById('myDivId'); function MyFunction() { alert(content.style.height);
I have some HTML that looks like this: <div class=product> Content In Here <div
I wrote a PHP code like this $site=http://www.google.com; $content = file_get_content($site); echo $content; But
It appears this code will request the file in Chrome and IE but not
I have an XML document with some sample content like this: <someTag> <![CDATA[Hello World]]>
Hi I have a div with content like this <div><strong>some content ....</strong></div> How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.