Jump to content

[SOLVED] I'm confused..preg_match_all() half works...half doesn't!


Recommended Posts

Hi,

For a very simple forum i have made my own little bit of code for entering URL's etc similar to the ones used by most main forum systems but the regex bit doesn't work properly.

Here is the little preg_match code:

  	$num_url = preg_match_all("#\[url=.{3,}\].{1,}\[/url\]#",$value,$results);
  	echo "num url:" . $num_url;

$value contains the origin string. In theory what i was aiming for was any string with

[url=(then min of 3 characters, for now)](min 1 character link)[/url]

 

I thought it was working fine up until today and its not liking this input:

Welcome to the Escape Network, We now have a proper site address [url=http://www.escape-network.co.uk]www.escape-network.co.uk[/url] and a mailing list [url=http://escape-network.co.uk/mailman/listinfo]HERE[/url], once you are signed up and confirmed anyone can send a message to all the members.   
You will need to sign up, after you have confirmed your email then i can set your access level to network member (if you are one!). 
Refer to the 
[url=forums.php?page=viewthread&id=1]Welcome 
Thread[/url] for info on stuff that is still being made. 
Feel free to sign up browse and break it, if anything does break let me know (email link in bottom left). 
By signing up you will have access to more options pictures and be able to contribute. 
[b]If people are having problems with the pop-up windows let me know[/b]

It returns the number of url's to be 2 not 3 and even if i add another url link it only recognises the first 2

 

Can anyone see what silly mistake i have made??!

Thanks in advance

Rich

Link to comment
Share on other sites

Thanks for the reply, Where i am testing this there is no newline and its still not working this is the output after running the script:

Welcome to the Escape Network, We now have a proper site address www.escape-network.co.uk and a mailing list HERE, once you are signed up and confirmed anyone can send a message to all the members.
You will need to sign up, after you have confirmed your email then i can set your access level to network member (if you are one!).
Refer to the
[url=forums.php?page=viewthread&id=1]Welcome Thread[/url] for info on stuff that is still being made.
Feel free to sign up browse and break it, if anything does break let me know (email link in bottom left).
By signing up you will have access to more options pictures and be able to contribute.
If people are having problems with the pop-up windows let me know

Even removing the space between the Welcome Thread bit makes no difference.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.