Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. How to write replace in php ?

How to write replace in php ?

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
javaphptoolstutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    udch
    wrote on last edited by
    #1

    Below replace i write in java script but now I need to write it in php ..... // for replace \n by commas because I will be getting multiple records var tmp = responseText.replace(new RegExp( "\\n", "g" ), ","); //Replace any double quotes var tmp1 = tmp.replace(new RegExp( "\"", "g" ),""); and scodeSplit = responseText.split("colspan=\"2\">"); scode = scodeSplit[1].split(" - EQ"); stockSymbol = scode[0].replace(/^\s+|\s+$/g, ''); How to write replace in php ?

    F A 2 Replies Last reply
    0
    • U udch

      Below replace i write in java script but now I need to write it in php ..... // for replace \n by commas because I will be getting multiple records var tmp = responseText.replace(new RegExp( "\\n", "g" ), ","); //Replace any double quotes var tmp1 = tmp.replace(new RegExp( "\"", "g" ),""); and scodeSplit = responseText.split("colspan=\"2\">"); scode = scodeSplit[1].split(" - EQ"); stockSymbol = scode[0].replace(/^\s+|\s+$/g, ''); How to write replace in php ?

      F Offline
      F Offline
      fly904
      wrote on last edited by
      #2

      Here[^]. The first link is what you are looking for. There are even examples if you scroll down the page.

      If at first you don't succeed, you're not Chuck Norris.

      1 Reply Last reply
      0
      • U udch

        Below replace i write in java script but now I need to write it in php ..... // for replace \n by commas because I will be getting multiple records var tmp = responseText.replace(new RegExp( "\\n", "g" ), ","); //Replace any double quotes var tmp1 = tmp.replace(new RegExp( "\"", "g" ),""); and scodeSplit = responseText.split("colspan=\"2\">"); scode = scodeSplit[1].split(" - EQ"); stockSymbol = scode[0].replace(/^\s+|\s+$/g, ''); How to write replace in php ?

        A Offline
        A Offline
        AndreasJ8
        wrote on last edited by
        #3

        At first i`m preffer preg_* ( alja Perl reg expression ) 1. here is man with many examples http://ru2.php.net/manual/en/function.preg-replace.php[^] 2. Look here if you use multiline text : http://ru2.php.net/manual/en/regexp.reference.internal-options.php[^] there are meny examples present.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups