Search Result

Collapse
6 results in 0.0039 seconds.
Keywords
Members
Tags
preg_replace
  •  

  • jeddiki
    started a topic Allowing underscore in preg_replace
    in PHP

    Allowing underscore in preg_replace

    Hello,

    I am using this:
    Code:
    preg_replace( somestuff  (.+?)  somestuff  );
    Does that (.+?) allow the underscore ?
    From my results, I suspect it doesn't

    To include the underscore, do I just add it like: (._+?) ?

    Don't know why but I think this might be wrong.
    See more | Go to post
    Last edited by Niheel; Mar 9 '11, 07:41 PM.

  • Using regex to add multiple restrict conditions to preg_replace array

    I have a great little script that will search a file and replace a list of words with their matching replacement word. I have also found a way to prevent preg_replace from replacing those words if they appear in anchor tags, img tags, or really any one tag I specify. I would like to create an OR statement to be able to specify multiple tags. To be clear, I would like to prevent preg_replace from replacing words that not only appear in an anchor...
    See more | Go to post

  • Why is preg_replace replacing only last occurance of target in string?

    I am developing an authoring system that includes footnote functionality. The system stores data as htmlspecialchar s encoded html. Footnotes are numbered in the source without regard to where the footnote appears in the text. So, footnote 5 could preceed footnote 1 in the html. When its time to process the document for presentation I am re-assigning the footnote numbers so that they appear sequentially in the text. I am trying to do this using...
    See more | Go to post

  • rienh
    started a topic Last word of string UpperCase
    in PHP

    Last word of string UpperCase

    Hello all, I try to accomplish the following.
    I have a string like: “volkswage n-golf-gti” **
    And I want it to change the string into:
    “Volkswage n Golf GTI” (last part completely uppercase)

    But I have some difficulties understanding preg_replace.
    Right now I have the following code:

    Code:
    <?php 
    $string = 'volkswagen-golf-gti'; 
    $string2 = ucwords(str_replace('-', ' ', $string)); 
    $string2
    ...
    See more | Go to post
    Last edited by rienh; Aug 30 '10, 02:10 PM. Reason: type error

  • dgriff80
    started a topic strip html but keep ' & ""
    in PHP

    strip html but keep ' & ""

    hello all!

    I am using a form that a user can fill out but for security reasons I want html stripped out. If the user inputs html, I want it to kick back saying something to the fact that it had html removed. What I have works just fine with one exception, I want people to be able to use

    Code:
    <?php
    $RemarksPure = Trim(stripslashes($_POST['remarks']));
    $Remarks = addslashes(preg_replace('#</?\w[^>]*>#',
    ...
    See more | Go to post

  • Jon
    Guest started a topic str_replace quirk
    in PHP

    str_replace quirk

    Why does the following not replace the ":)"?
    str_replace(":) ", "&nbsp;<img
    src=http://www.com.com/forum/emoticons/smiley.gif>&nbs p;", $_POST['Tip']);

    But, the following does replace the ":("?

    str_replace(":( ", "&nbsp;<img
    src=http://www.com.com/forum/emoticons/crying.gif>&nbs p;", $_POST['Tip']);


    --...
    See more | Go to post
Working...