Re: [PHP] eregi_replace() function in a script

2002-12-01 Thread Anthony Ritter
Holmes: >That's just the pattern you showed. It may not match anything, so nothing gets > replaced with eregi_replace() and hence no "active link" is created, but > it may not necessarily cause an error. . Right. The pattern does not match anything in the input string of $Arra

RE: [PHP] eregi_replace() function in a script

2002-12-01 Thread John W. Holmes
> $Pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])"; > $Replace = "http://\\2\\3\"; target=\"_new\">\\2\\3"; > $Array["URL"] = eregi_replace($Pattern, $Replace, $Array["URL"]); > > print ("Your submission--$Array[URL]--has been received!\n"); That does no checking or validation at all.

Re: [PHP] eregi_replace() function in a script

2002-12-01 Thread Anthony Ritter
> Well, whether it causes an error not depends on your code. That's just > the pattern you showed. It may not match anything, so nothing gets > replaced with eregi_replace() and hence no "active link" is created, but > it may not necessarily cause an error. > > Can you show me some of the code in c

RE: [PHP] eregi_replace() function in a script

2002-12-01 Thread John W. Holmes
> For instance, let's say I put _absolutely nothing_ in the URL textbox and > then hit submit - the PHP still processes _without_ an error. > > It says: > "Your submission -- -- has been received!" > > I would've thought the eregi_replace() function would've validated an > entry > with no charact

Re: [PHP] eregi_replace() function in a script

2002-12-01 Thread Anthony Ritter
John W. Holmes: > Yes, that's correct. That piece of the pattern matches anything that's > not a space, one or more times. > > > I tried the script by putting a space before the URL and the PHP still > > processes the data with no error. > > A space before everything is fine, as the pattern will m

RE: [PHP] eregi_replace() function in a script

2002-12-01 Thread John W. Holmes
> The script works fine but I have a question with the following line: > > $Pattern="(http://)([^[:space:]]+) ([[:alnum:]\.,-?/&=])"; // The variable > $Pattern is declared with three groupings. > > My question: > If the user inadvertantly inputs a *space* _after_ the http:// grouping > and > _be