mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Fix escaping of \ in character class.
> Rejeté. Ce n'est pas un escape. D’après mes tests, c’est considéré comme un escape. Doubler le caractère serait suffisant. const url = 'https://example\\.com'; const urlRegexp1 = /https?:\/\/[-a-zA-Z0-9@:%/._\+~#=?]+[-a-zA-Z0-9@:%/_\+~#=]/g; const urlRegexp2 = /https?:\/\/[-a-zA-Z0-9@:%/._\\+~#=?]+[-a-zA-Z0-9@:%/_\\+~#=]/g; console.log(url.length); // 20 console.log(urlRegexp1.exec(url)); // ["https://example"] console.log(urlRegexp2.exec(url)); // ["https://example\.com"]
This commit is contained in:
parent
33610e89f8
commit
31a5a8e8f1
1 changed files with 1 additions and 1 deletions
|
@ -738,7 +738,7 @@ function gotPermissions(perm) {
|
|||
displayUsername();
|
||||
}
|
||||
|
||||
const urlRegexp = /https?:\/\/[-a-zA-Z0-9@:%/._\+~#=?]+[-a-zA-Z0-9@:%/_\+~#=]/g;
|
||||
const urlRegexp = /https?:\/\/[-a-zA-Z0-9@:%/._\\+~#=?]+[-a-zA-Z0-9@:%/_\\+~#=]/g;
|
||||
|
||||
function formatLine(line) {
|
||||
let r = new RegExp(urlRegexp);
|
||||
|
|
Loading…
Reference in a new issue