Hacker News new | ask | show | jobs
by sys32768 1018 days ago
For that query, the Chrome developer tools console spits an error like so:

>d.7527c434450544045365.js:1 Uncaught (in promise) SyntaxError: Invalid regular expression: /^(https?://)?([\w\.-_]*\.)?notepad++\./: Nothing to repeat (at

3 comments

If you set a breakpoint there, the value it is trying to replace is "Notepad++" rather than "notepad", gotten from the Heading of "http://www.notepad-plus-plus.org" further up in the logic chain. Looks like the plus signs are incorrectly being added to the RegEx
Was someone trying to be funny, to change a "notepad" search for "notepad++", forgetting that + has a specific meaning in regex? Same error occurs with a search for "notepad++", though, but not "notepad+", funnily enough.
wouldn't this be worse for not having the user provided search query sanitized for special characters?
My assumption is wrong. As others have noted, it's clearly parsing the title of the first result wrong. Edit: It's the parsing of the title of the infobox.
Looks like a regex to detect notepad++ in a url that didn't escape the +'s? Weird, maybe a sponsorship thing
Yep they need to escape every character in the string not just the plus signs