Adding regex comments.

This commit is contained in:
softsimon 2023-02-22 10:19:19 +04:00
parent c1a3b5f045
commit b6792784e8
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -363,8 +363,8 @@ class NodesApi {
try {
const publicKeySearch = search.replace('%', '') + '%';
const aliasSearch = search
.replace(/[-_.]/g, ' ')
.replace(/[^a-zA-Z0-9 ]/g, '')
.replace(/[-_.]/g, ' ') // Replace all -_. characters with empty space. Eg: "ln.nicehash" becomes "ln nicehash".
.replace(/[^a-zA-Z0-9 ]/g, '') // Remove all special characters and keep just A to Z, 0 to 9.
.split(' ')
.filter(key => key.length)
.map((search) => '+' + search + '*').join(' ');