SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: preg_replace question

  1. #1
    SitePoint Evangelist
    Join Date
    Nov 2009
    Posts
    466
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    preg_replace question

    I know this should be a simple question, but I can't seem to get the syntax. I want to replace any character found in a list of individual characters in an expression with another character. So I want to provide a list like \&\,\.\@ and replace them with a space in an expression $exp.

    Thanks

  2. #2

  3. #3
    SitePoint Evangelist
    Join Date
    Nov 2009
    Posts
    466
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, didn't realize I could use arrays with str_replace. That is exactly what I need in this case.

    But just out of curiousity is there a way to do it with preg_replace?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •