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 6580035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:58:27+00:00 2026-05-25T15:58:27+00:00

Possible Duplicate: RegEx match open tags except XHTML self-contained tags Hello first of I

  • 0

Possible Duplicate:
RegEx match open tags except XHTML self-contained tags

Hello first of I would like to say I’m a beginner.

My problem is I’m developing a video site, the site pulls an xml from an other site, and saves the data in my database.

In the embed adds a:

<div style="margin:auto" align="center">-
embed here
</div>

And an achor with text upload free videos here.

Now I would like to remove these with preg replace but its not working.

function insertvids() {

        $url = "http://thesite/rss.xml";
        $data = simplexml_load_file($url, "SimpleXMLElement", LIBXML_NOCDATA);
        //print_r($data->channel->item);

        foreach ($data->channel->item as $r)
        {
          $title = $r->title; 
          $description = $r->description;
          $embed = $r->embed;
          $thumb = $r->image;
          $duration = $r->duration;

           $string = $r->embed;

           $replace = array();
           $replace[0] = '-<div style="margin:auto" align="center">-';
           $replace[1] = '-<a href="http://thesite.com" target="_blank">-';
           $replace[3] = '-Unlimited video upload for free.-';
           $replace[4] = '-</a></div>-';
            $replaceto = array();
            $replaceto[0] = ' ';
            $replaceto[1] = ' ';
            $replaceto[2] = ' ';
            $replaceto[3] = ' ';
            $replaceto[4] = ' ';


            preg_replace($replace, $replaceto, $string);

            $data = array(
              'title' => ''.$title.'', 
              'description' => ''.$description.'',
              'thumbnail' => ''.$thumb.'',
              'embed' => ''.$embed.'',
              'duration' => ''.$duration.'',
              'type' => 'slutload'
        );
            $this->db->insert('videos', $data);
            //print_r($data) . "<br>";
        }

    }

Was trying to figure out what im missing. If I run the script it does nothing, if I change the – to / it gives me and error that it’s not valid.

Could someone please point out what I’m doing wrong?

  • 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-25T15:58:27+00:00Added an answer on May 25, 2026 at 3:58 pm

    Preg_replace doesn’t modify the parameters. It will only return an array or a string (according to the type of parameters).

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

Sidebar

Related Questions

Possible Duplicate: RegEx match open tags except XHTML self-contained tags i want to grap
Possible Duplicate: RegEx match open tags except XHTML self-contained tags I have this list
Possible Duplicate: RegEx match open tags except XHTML self-contained tags What is the fastest
Possible Duplicate: RegEx match open tags except XHTML self-contained tags How to remove single
Possible Duplicate: RegEx match open tags except XHTML self-contained tags I have a HTML
Possible Duplicate: RegEx match open tags except XHTML self-contained tags I am having trouble
Possible Duplicate: Strip html from strings in python RegEx match open tags except XHTML
Possible Duplicate: Regex exec only returning first match a1b2c3d.replace(/[0-9]/g,x) returns axbxdxd as expected. /[0-9]/g.exec(a1b2c3d)
Possible Duplicate: Regex for matching javadoc fragments I have files having content like /**
Possible Duplicate: Escape string for use in Javascript regex I have a msg like

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.