Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    about a function

    Hi everyone,

    I was working on a function that has array where the content(indexes)
    of this array are VoiceMail messages, I was trying to set up a regular expression
    that gets the first message(i.e index 1), but it is giving me all all contents (i.e index 1 and index 2).

    Can anyone see what I might be getting wrong ?
    my objective is to extract the first index like this:

    " message-one hi this is abdi if you get this message please call me."

    here is javascript:


    Code:
    <script> 
    function test(message)  {
            MessageArray = new Array ("message-one hi this is abdi if you get this message please call me.",
                                      "hi jack you are missing something very interesting,if you get this message please call me");
           
           var  z  = /\b(message-one\s+.* )\b/gi;
            test = z.exec(MessageArray);
            return  test  ;                                                 
          
       }
       
    </script>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    why do you need regexp? you can just do:

    alert(MessageArray[0]); //first item
    alert(MessageArray[1]); //2nd item


  •  

    Posting Permissions

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