My first problem might be the easier of the two. I have this
function that accepts two named arguments and 3 additional unnamed
ones. Depending on the value of the 4th argument (True or False) if
passed in, the 5th argument is used.
My problem is, it seems to me that if the 4th argument is
passed in as False, CF quits reading the arguments. I checked the
length of Arguments array in the function and it always reads 4
(including the False) but ignores everything past this value.
Is this supposed to happen?
//Searches for tagname in str with attributes in array
attarr.
//Returns start tag only if startOnly is True.
//If startOnly is False, and innerHTML is passed in, checks
to see if the content between start tag and end tag matches this.
function getTag(str,tagname) //attarr,startOnly,innerHTML
{
}
//function call, page holds an html page I retrieved already,
attarr is defined ArrayNew(2) earlier
attarr[1][1]="name";
attarr[1][2]="myForm";
form = getTag(page,"form",attarr);//This works and finds the
form.
attarr[1][1]="name";
attarr[1][2]="error";
form = getTag(form,"label",attarr,False,"That name is already
used."); //This fails, function says only 4 arguments passed in.
Second problem is insane. (imagine pulling hair out in
clumps, red eyed, holding half empty energy drink)
500 Null, ooopps, the dreaded.
It always occurs when I'm using a regular expression that
isn't 100% greedy. Let me give an example.
Here is a basic re to match html tags.
Notice the * after [^<]. This is the greedy form that
works.
<#tagname#[^>]*>(([^<]*|[<](?!/#tagname#>))*)</#tagname#>
I want to know why I can't leave this greediness out, and
have it match the zero or more subexpressions instead, but more
importantly, I want to know how I can get CF to turn its head and
cough.
I mean, how am I supposed to find out what is going wrong
when it just displays 500 Null.
I did the comment dance and narrowed it down to this part of
the re
([^<]|[<](?!/#tagname#))*
To me this reads, give me a character that is not < or
give me one that is < as long as /#tagname# doesn't follow.
Now give me zero or more of these characters.
Am I wrong here? And is there a way to catch 500 Nulls at
all? Just in case there is a problem in one of my re's that doesn't
pop up in testing, but shows up in production. I want to shut the
page down softly. Not abruptly. I appreciate the help.
Sorry for being long winded, but I've spent three days on
these errors without any luck.