SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Servyces's Avatar
    Join Date
    Jun 2007
    Location
    The Netherlands
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dreamweaver Regex question

    Hi all,

    I'm in the process of re-coding a script to work without register_globals.
    I want to use the search and replace function from Dreamweaver to speed things up.

    Now, I have the following regex search pattern which works pretty well:

    Code:
    \$[A-Za-z0-9]+
    What I want to do is replace the string with $_POST[''] around it and the $ stripped, however, I can't seem to get this done as I can't find a way to re-use the string found in the replace pattern. I tried $1 ($1) $ and such, but no luck, it just literally puts the whole regex as replace text.

    Is there any trick to use the found string again in the replace pattern?

    Thanks.
    Servyces.com
    Where itís all about you.
    Your partner in online solutions.
    Visit our website at http://www.servyces.com/

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should work:

    Search Regex:
    Code:
    \$([A-Za-z0-9]+)
    Replace Regex:
    Code:
    $_POST['$1']
    Let me know if that works

  3. #3
    SitePoint Zealot Servyces's Avatar
    Join Date
    Jun 2007
    Location
    The Netherlands
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, that works. Forgot the parenthesis's. Thanks.
    Last edited by Servyces; Jul 8, 2007 at 17:20.
    Servyces.com
    Where itís all about you.
    Your partner in online solutions.
    Visit our website at http://www.servyces.com/


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
  •