Page 1 of 1

Fail to understant this code

Posted: Sun May 24, 2009 9:44 pm
by prasunhowlader
I am fail to understand this

/\[\[([^|]*?)(?:\|([^|]*?)){0,1}\]\]/.exec(http.responseText) of this line

var result = /\[\[([^|]*?)(?:\|([^|]*?)){0,1}\]\]/.exec(http.responseText);

Please help me for this.

Re: Fail to understant this code

Posted: Sun May 24, 2009 10:16 pm
by requinix
It's running a regular expression on the results of some AJAX call, looking for stuff like [[text]] or [[text|more text]].

Huh... looks to me like the expression has a bug in it...

Re: Fail to understant this code

Posted: Mon May 25, 2009 12:00 am
by mikemike
Yeah looks like faulty regexp to me too

Re: Fail to understant this code

Posted: Mon May 25, 2009 12:10 am
by requinix
mikemike wrote:Yeah looks like faulty regexp to me too
How so? We might have noticed different things.

Re: Fail to understant this code

Posted: Mon May 25, 2009 12:15 am
by mikemike
On second glance I'm actually not sure. I could have swarn it was missing a closing square bracket earlier.....

Re: Fail to understant this code

Posted: Mon May 25, 2009 10:42 am
by prasunhowlader
Dear sir,
I have taken this code from Open source "OSCommerce project" and the code is running well.