#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Need regex code for dreamweaver


    Can anyone help? Need regex code for dreamweaver to make the curly bracket on the end of this line, drop to new line.
    From:
    // str_replace("needle", "replace text", haystack); {
    To:
    // str_replace("needle", "replace text", haystack);
    {


    Want it to affect any line starting with // and ending in ; {

    Thanks!!

    Max
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Location
    spaceBAR Central
    Posts
    225
    Rep Power
    41
    Try this:
    Code:
    Find:
    //.+({)$
    Replace:
    \n$1
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    Didn't work.
    Thanks anyway.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Location
    spaceBAR Central
    Posts
    225
    Rep Power
    41
    The find pattern(//.+({)$) matches your example below(Note: The '{' has to be at the end of the line):
    Code:
    // str_replace("needle", "replace text", haystack); {
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    Hi spacebar208, The { is at the end of the line (or seems to be), but it doesn't work.
    Was reading that $ in Dreamweaver regex means end of file and not end of line, is this right?
    Thanks!
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Location
    spaceBAR Central
    Posts
    225
    Rep Power
    41
    The '$' matches End of line, Check out this info on 'Dreamweaver' regular expressions:
    http://www.adobe.com/devnet/dreamwea...sions_pt1.html
    http://www.adobe.com/devnet/dreamwea...sions_pt2.html
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo