SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Swindon
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    rereplace syntax

    Hi all,

    How could i strip anything from a string between two [] ?

    I looked at rereplace - but i dont know how to look for braces and their contents

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Start by escaping the braces, then go from there.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    SitePoint Zealot YAHA's Avatar
    Join Date
    Jan 2008
    Location
    MD, US
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could find the position of the "[" - opening bracket and the "]" closing bracket. Then use the RemoveChars(string, start, count) function, where start is the position of your "[" and end is calculated as position of "]" in the string minus the position of "[". If you want a more detailed explanation, post your code and we will help you.

  4. #4
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Swindon
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    incase it helps anyone I managed to adapt the code i found for stripping html and got this to work

    Code:
    <cfset newTitle = Trim(REReplace(Title,'\[[^\]]*\]','','all'))>


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
  •