www.webdeveloper.com
Results 1 to 3 of 3

Thread: Regular Expression Help.

  1. #1
    Join Date
    Feb 2009
    Posts
    93

    Regular Expression Help.

    Hi,
    I need a regular expression which removes text from|to : and replace with a space from the following string:

    abcd2DPM_0361.DSS|1588224: abcdinterv120808wc.doc|28672: abcdDPM_0360.DSS|563712: abcd3_0365.DSS|1565184: Abcd_Last-GK.DSS|771072:

    Thanks

  2. #2
    Join Date
    Feb 2006
    Posts
    2,926
    var s='abcd2DPM_0361.DSS|1588224: abcdinterv120808wc.doc|28672: abcdDPM_0360.DSS|563712: abcd3_0365.DSS|1565184: Abcd_Last-GK.DSS|771072:';

    s.replace(/\|[^:]*\:/g,' ');
    //replace pipe followed by any number of charaters to and including a single colon, with a space

    /* returned value: (String)
    abcd2DPM_0361.DSS abcdinterv120808wc.doc abcdDPM_0360.DSS abcd3_0365.DSS Abcd_Last-GK.DSS
    */

  3. #3
    Join Date
    Feb 2009
    Posts
    93
    Thank you for replying. But I am getting 2 spaces after each name eg abcd2DPM_0361.DSS abcdinterv120808wc.doc. I need only 1 space between each name.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles