1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

SWIFT Valid Chars

Discussion in 'Programming' started by datropics, Feb 19, 2007.

  1. #1
    These are the valid characters of SWIFT: " a-zA-Z0-9,.:'\+\(\)\?'\-/" (exclude the double quotes - just wanted to show the space).

    How do I construct a regular expression to remove all OTHER text except the above from a string. I'm using ColdFusion but I don't think this is a cold fusion question it is more a reg-ex question (of which I am quite green).

    This is what I have for my search string !([ a-zA-Z0-9,.:'\+\(\)\?'\-/]). I'm trying to figure what I am doing wrong.

    This is what I have:
    <cfset Valids = "!([ a-zA-Z0-9,.:'\+\(\)\?'\-/])">
    <cfset CleanString = ReReplace(Arguments.DirtyString,Valids,"","ALL")>

    What "I THINK" I am saying is replace all characters that are not in the list of Valid Chars with an empty string. Any help would be appreciated.



    Thanks!!
     
    datropics, Feb 19, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Try
    
    [^\sa-zA-Z0-9,\.:'\+\(\)\?'\-/]
    
    Code (markup):
    Note the ^ at the beginning.
     
    nico_swd, Feb 19, 2007 IP
  3. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Excellent - thanks!

    PS: I've been working on that for 9 days now - lol. Have any resources that I can go to that teaches reg-ex????

    Thanks again!!!
     
    datropics, Feb 19, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    nico_swd, Feb 19, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    By the way, I don't know if the expressions change in CF, but in PHP you have to escape the dot, cause it stands for any character. I added the escape slash. Remove it if it needs to be removed in CF...
     
    nico_swd, Feb 19, 2007 IP
  6. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #6
    Works like a champ! - thanks man!
     
    datropics, Feb 19, 2007 IP
  7. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #7
    nico_swd, Feb 20, 2007 IP
  8. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #8
    no the links you gave were great - thanks man!
     
    datropics, Feb 21, 2007 IP