{"action":"created","issue":{"url":"https://api.github.com/repos/Yoast/wordpress-seo/issues/3598","repository_url":"https://api.github.com/repos/Yoast/wordpress-seo","labels_url":"https://api.github.com/repos/Yoast/wordpress-seo/issues/3598/labels{/name}","comments_url":"https://api.github.com/repos/Yoast/wordpress-seo/issues/3598/comments","events_url":"https://api.github.com/repos/Yoast/wordpress-seo/issues/3598/events","html_url":"https://github.com/Yoast/wordpress-seo/issues/3598","id":122632420,"number":3598,"title":"[Premium] Bug fix with Regex Redirects","user":{"login":"donwilson","id":422444,"avatar_url":"https://avatars.githubusercontent.com/u/422444?v=3","gravatar_id":"","url":"https://api.github.com/users/donwilson","html_url":"https://github.com/donwilson","followers_url":"https://api.github.com/users/donwilson/followers","following_url":"https://api.github.com/users/donwilson/following{/other_user}","gists_url":"https://api.github.com/users/donwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/donwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donwilson/subscriptions","organizations_url":"https://api.github.com/users/donwilson/orgs","repos_url":"https://api.github.com/users/donwilson/repos","events_url":"https://api.github.com/users/donwilson/events{/privacy}","received_events_url":"https://api.github.com/users/donwilson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-17T00:04:23Z","updated_at":"2016-03-07T11:34:14Z","closed_at":"2016-03-07T11:34:14Z","body":"Hello, there's an easily reproducible (and easily fixable) bug with the Yoast Premium SEO plugin. I've made an attempt to report the bug through the regular email support channel back in April but it was required I provide my company's license info. Now that it's December and it still hasn't been changed, I figured I'd try another route.\r\n\r\nThere's a bug with the regex redirect functionality in the premium plugin when matching user-supplied regex with a redirect url. When the URL the user is redirected to contains a number, the plugin attempts to replace that number with a match at that number's index value.\r\n\r\nSimply put, if I add a new \"Regex Redirect\" rule with the following settings:\r\n\r\n    Regular Expression: ^/banana-([A-Za-z0-9]+)/?$\r\n\r\n    URL: /banana-1-$1/\r\n\r\nthen a user goes to ```/banana-bread/```, one would expect to be taken to ```/banana-1-bread/```. However, the user is taken to ```/banana-/banana-bread/-bread/```.\r\n\r\nThis is caused by a mis-placed ```\\$``` symbol in the preg_replace_callback regex on ```line 66``` of ```/wordpress-seo-premium/premium/classes/class-regex-redirect-manager.php```. The regex currently used is ```/[\\$0-9]+/``` and is wrong, as it matches any string containing numbers and/or dollar sign (eg 1 or 1$1 or $1). The \\$ should be outside of the brackets as such: ```/\\$[0-9]+/```\r\n\r\nSee the attached screenshot for straight forward, easily reproducible proof.\r\n\r\n![untitled-4](https://cloud.githubusercontent.com/assets/422444/11857571/1053fe52-a41f-11e5-846e-1da0c0bd783e.png)"},"comment":{"url":"https://api.github.com/repos/Yoast/wordpress-seo/issues/comments/193214915","html_url":"https://github.com/Yoast/wordpress-seo/issues/3598#issuecomment-193214915","issue_url":"https://api.github.com/repos/Yoast/wordpress-seo/issues/3598","id":193214915,"user":{"login":"Rarst","id":737584,"avatar_url":"https://avatars.githubusercontent.com/u/737584?v=3","gravatar_id":"","url":"https://api.github.com/users/Rarst","html_url":"https://github.com/Rarst","followers_url":"https://api.github.com/users/Rarst/followers","following_url":"https://api.github.com/users/Rarst/following{/other_user}","gists_url":"https://api.github.com/users/Rarst/gists{/gist_id}","starred_url":"https://api.github.com/users/Rarst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rarst/subscriptions","organizations_url":"https://api.github.com/users/Rarst/orgs","repos_url":"https://api.github.com/users/Rarst/repos","events_url":"https://api.github.com/users/Rarst/events{/privacy}","received_events_url":"https://api.github.com/users/Rarst/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T11:34:14Z","updated_at":"2016-03-07T11:34:14Z","body":"Issue moved to the Premium's tracker."}}