Hi, everyone. I have this code when I'm reading in a file:
I'm try to find patterns for those two tags within my file, which has been loaded into the lines array. I have looked at regular expressions and it seems that they seem to operate on strings. So I have tried assigning the array to a string first and peforming on the exec() and match() methods on the string. However I've had no luck. I need something that returns either true or false on whether each pattern occurs somewhere in my file (the lines array).
Thanks in advance. :)
Code:
// read lines into array
var line = {}, lines = [], hasmore;
do
{
hasmore = istream.readLine(line);
lines.push(line.value);
}
while(hasmore);
istream.close();
// check inported file is valid by looking for <privatemessage>
// and <fromuserid> tags using regular expressions.
var pmtag = /^\<privatemessage\>$/;
var fuidtag = /^\<fromuserid\>$/;
Thanks in advance. :)
Comment