MyBB Community Forums

Full Version: regex help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
$this->ipsclass->vars['irc_name'] = preg_replace("/^a-zA-Z0-9_/", "-", $this->ipsclass->vars['irc_name'] );

this line is causing this error

Quote:Warning: preg_replace() [function.preg-replace]: No ending delimiter '^' found in /home/XXX/public_html/sources/components_public/javairc.php on line 100

any suggestions on best way to make that regex/preg_replace no throw any errors
Well I suck at RegEx but the error says no ending ^ found...

Try adding one...

$this->ipsclass->vars['irc_name'] = preg_replace("/^a-zA-Z0-9_^/", "-", $this->ipsclass->vars['irc_name'] );
That is quite obviously a modification for IPB.

Do you really think it is wise to be posting it here?

As for your regular expression, it's structured completely wrong. /[^a-zA-Z09_]/ would be a working version.

Next time, post on the IPB forums if you have a question related to their product.
umm this is an IPB MODULE I am making NOT 1 IPS are making and it is also 1 in dev. for MyBB Chris please read in dev. forums on here I am basically starting with IRC chat for IPB then MyBB then vb modules

but I need regex issues fixed before I can release it on any BB