Results 1 to 4 of 4

Thread: Need to replace ; allcharacters

  1. #1
    Join Date
    Oct 2012
    Posts
    180
    Thanks
    22
    Thanked 1 Time in 1 Post

    Default Need to replace ; allcharacters

    Need to replace ; allcharacters using:

    title = title.replace(//g, '');

    1. There's a space after ;
    2. By allcharacters I mean A-Z a-z 0-9 _
    Last edited by qwikad.com; 09-06-2015 at 01:11 AM.

  2. #2
    Join Date
    Oct 2012
    Posts
    180
    Thanks
    22
    Thanked 1 Time in 1 Post

    Default

    Actually after I posted this I tried title = title.replace(/\; .*/, ''); and it seems to be working fine. Is there a better way of doing this? It's tripping all characters (which I am fine with).

  3. #3
    Join Date
    Apr 2006
    Posts
    205
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    I find http://www.regexr.com/ a really useful resource for making sure your regular expressions are doing what you want them to.
    I'm not a regEx expert but I'd suggest:
    Code:
    title = title.replace(/\;+./g, ';');
    That should replace any character (other than a newline) that follows a semicolon (;) with just a semicolon.

    Hope that helps.
    Last edited by dog; 09-04-2015 at 10:18 PM. Reason: subscribing to topic

  4. #4
    Join Date
    Oct 2012
    Posts
    180
    Thanks
    22
    Thanked 1 Time in 1 Post

    Default

    Thank you, really appreciate it!

Similar Threads

  1. Resolved Need to replace everything #/W#
    By BLiZZaRD in forum PHP
    Replies: 4
    Last Post: 10-12-2012, 10:55 PM
  2. Replies: 2
    Last Post: 04-25-2012, 01:02 AM
  3. DWMR:WHEN I press FIND&REPLACE eg xxxzzz.com with zzz.com and choose ALL SITE REPLACE
    By leonidassavvides in forum Computer hardware and software
    Replies: 0
    Last Post: 04-16-2009, 06:32 PM
  4. Replies: 6
    Last Post: 02-19-2009, 07:30 AM
  5. replace()
    By Schmoopy in forum JavaScript
    Replies: 26
    Last Post: 12-02-2008, 05:14 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
  •