Live data from Hacker News

Searching for “notepad” on DuckDuckGo yields zero results

duckduckgo.com

11–20 of 44 posts

Re: Searching for “notepad” on DuckDuckGo yields zero results

#11
post #4

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

Looks like a regex to detect notepad++ in a url that didn't escape the +'s? Weird, maybe a sponsorship thing

Re: Searching for “notepad” on DuckDuckGo yields zero results

#12
It seems that anything that returns "++" (EDIT: in the "About" box), in this case "Notepad++", breaks their internal regex because it seems not to be sanitized properly

The breaking code using chrome dev tools seems to be:

n = new RegExp("^(https?://)?([\\w\\.-_]\\.)?" + o.toLowerCase().replace(/[-\s]/g, "") + "\\.");

In this case "o" is "Notepad++" which might be the first result.

The browser returns this error:

Invalid regular expression: /^(https?://)?([\w\.-_]\.)?notepad++\./: Nothing to repeat

Also happens with C++ https://duckduckgo.com/?q=c%2B%2B&t=ffab&ia=web

Re: Searching for “notepad” on DuckDuckGo yields zero results

#13
so does "cplusplus"

It seems to have to do with some kind of metadata is fetched and then used as a regular expression (to change markup in some other part of the page?); it's assumed that the text can be used as a regular expression without quotation but in the case of the doubled "+" character it becomes a non-valid RE.

Re: Searching for “notepad” on DuckDuckGo yields zero results

#14
post #4

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

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

Re: Searching for “notepad” on DuckDuckGo yields zero results

#15
post #12

It seems that anything that returns "++" (EDIT: in the "About" box), in this case "Notepad++", breaks their internal regex because it seems not to be sanitized properly The breaking code using chrome dev tools seems to be: n = new RegExp("^(https?://)?([\\w\\.-_] \\.)?" + o.toLowerCase().replace(/[-\s]/g, "") + "\\."); In this case "o" is "Notepad++" which might be the first result. The browser returns this error: In…

Curious that the error does not occur when searching for "Notepad+": https://duckduckgo.com/?q=notepad%2B&t=ffab&atb=v101-1&ia=we...

Re: Searching for “notepad” on DuckDuckGo yields zero results

#16
post #11
post #4

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

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

Re: Searching for “notepad” on DuckDuckGo yields zero results

#17
post #10
post #4

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

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?

Re: Searching for “notepad” on DuckDuckGo yields zero results

#18
post #12

It seems that anything that returns "++" (EDIT: in the "About" box), in this case "Notepad++", breaks their internal regex because it seems not to be sanitized properly The breaking code using chrome dev tools seems to be: n = new RegExp("^(https?://)?([\\w\\.-_] \\.)?" + o.toLowerCase().replace(/[-\s]/g, "") + "\\."); In this case "o" is "Notepad++" which might be the first result. The browser returns this error: In…

"cpp" seems to work fine though, and returns many results that include "c++"... https://duckduckgo.com/?q=cpp&t=ffab&ia=web

Re: Searching for “notepad” on DuckDuckGo yields zero results

#19
post #10

Earlier quoted context omitted.

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.

Re: Searching for “notepad” on DuckDuckGo yields zero results

#20
post #15
post #12

It seems that anything that returns "++" (EDIT: in the "About" box), in this case "Notepad++", breaks their internal regex because it seems not to be sanitized properly The breaking code using chrome dev tools seems to be: n = new RegExp("^(https?://)?([\\w\\.-_] \\.)?" + o.toLowerCase().replace(/[-\s]/g, "") + "\\."); In this case "o" is "Notepad++" which might be the first result. The browser returns this error: In…

Curious that the error does not occur when searching for "Notepad+": https://duckduckgo.com/?q=notepad%2B&t=ffab&atb=v101-1&ia=we...

In this scenario all the "o" instances are "Notepad+".

The error seems to be coming from the right sidebar which displays "Notepad+" as a title as well. It seems to be getting the "Heading" from the wikipedia page

Here is the object where it extracts the heading from, it seems in this scenario it is not extracting "Notepad++" in the about but "Notepad+" which is another application.

```

Abstract: "Notepad+ is a freeware text editor for Windows operating systems and is intended as a replacement for the Notepad editor installed by default on Windows. It has more formatting features but, like Notepad, works only with plain text. It can open text files of any size, and a single instance of the program can have multiple files open simultaneously. It supports dragging and dropping text within a file and between files, and supports multiple fonts and colours. Notepad+ is available from the company RogSoft. It was developed by Dutch programmer Rogier Meurs. It was first released in 1996. Originally, it had the advantage of being able to open files of any size, because until 2000 Notepad could not open files larger than 64 KB." AbstractSource: "Wikipedia" AbstractURL: "https://en.wikipedia.org/wiki/Notepad%2B" Heading: "Notepad+"

```

Post reply on HN