...

View Full Version : about a function



Abdi
10-23-2003, 05:31 AM
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:





<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>

glenngv
10-23-2003, 05:42 AM
why do you need regexp? you can just do:

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum