Thanks to Bluesplinter, I found the problem. I added a period outside the brackets here:
preg_match( '/[^a-z0-9]+/.', $blogname )
when it should have been inside the brackets 🙂
Can you post the new REGEX? Offhand, sounds like it might allow multiple dots in a row, which wouldn’t be a valid URL…
if ( preg_match( '/[^a-z0-9.]+/', $blogname ) )
Above is the new REGEX. Notice I moved the period inside the [] brackets. For the record, I’m a complete noob when it comes to REGEX 🙂
That WILL allow dots in the blogname, BUT, it’ll also allow the following invalid patterns:
.blogname.domain.com
blog…..name.domain.com
blog.name..domain.com
IOW, it will allow the dot character anywhere, and any number of times. Probably not what you want, since those are invalid URLs. 🙂
That can get confusing in the midst of a preg_match that returns an error if TRUE — like we need more confusion. What I’d probably do is go ahead and use your modified REGEX in that preg_match test, and then add a second test to your filter, looking for a starting|trailing dot, or a string of more than one dot. And I would probably NOT do that second check with REGEX! <g>
Good points…Fortunately this is for code that users cannot use to create invalid domains/names/etc 🙂