Fail to understant this code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
prasunhowlader
Forum Newbie
Posts: 2
Joined: Sun May 24, 2009 9:40 pm

Fail to understant this code

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Fail to understant this code

Post 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...
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: Fail to understant this code

Post by mikemike »

Yeah looks like faulty regexp to me too
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Fail to understant this code

Post by requinix »

mikemike wrote:Yeah looks like faulty regexp to me too
How so? We might have noticed different things.
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: Fail to understant this code

Post by mikemike »

On second glance I'm actually not sure. I could have swarn it was missing a closing square bracket earlier.....
prasunhowlader
Forum Newbie
Posts: 2
Joined: Sun May 24, 2009 9:40 pm

Re: Fail to understant this code

Post by prasunhowlader »

Dear sir,
I have taken this code from Open source "OSCommerce project" and the code is running well.
Post Reply