+ Reply to Thread
Results 1 to 2 of 2

Thread: Help with JS function

  1. #1
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Help with JS function

    Help! I'm no javascript programmer, but sometimes it can't be avoided. I'd willingly try to figure this out, but I'm on deadline.

    I need a statement or two that will remove any character from a string that is NOT a capital letter or a number; thus:
    Code:
    O'HARA-SMITH_JANE_Q1
    would become
    OHARASMITH_JANE_Q1
    
    If you are feeling truly magnanimous, I also need a regex validator for same (but can include lower case characters, since I toUpper the string before I store it).

    Mega cudos in advance.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  2. #2
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    OK - so I had to crack open my almost untouched JavaScript reference, but found what I was looking for. For the lurkers who might be looking for an answer like this, I coded:
    Code:
     urlBox.value = urlText.replace(/[^\w\d_]*/gi, "")
    
    Q.E.D.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

+ Reply to Thread

Similar Threads

  1. Using InStr Function
    By todd2006 in forum ASP Development
    Replies: 2
    Last Post: April 24th, 2009, 10:59 AM
  2. calling function
    By guddu in forum ASP Development
    Replies: 3
    Last Post: November 5th, 2008, 09:34 AM
  3. Help using function
    By Rebelle in forum ASP Development
    Replies: 11
    Last Post: October 13th, 2008, 01:13 PM
  4. ASP 2 way encryption function
    By dr_rock in forum ASP Development
    Replies: 2
    Last Post: August 14th, 2008, 09:01 AM
  5. without function
    By guddu in forum Microsoft SQL Server
    Replies: 1
    Last Post: July 15th, 2008, 05:02 PM

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

SEO by vBSEO