A Space being added to url generated by custom plugin

In your regex there is a space before the # $mh_regex = "/\ #[a-zA-Z0-9-]+/"; so it would match # tag instead of #tag.

It might be a good idea to test your regex using this online tool: http://www.regexr.com/ it’s really usefull for testing

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)