Skip to content

Commit

Permalink
update regex for Gecko and Clecko (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchezzzhak committed Mar 25, 2024
1 parent 1b8bc2d commit b34fd69
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions parser/client/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,12 @@ class Browser extends ClientAbstractParser {
if (engine === '') {
return '';
}

if (engine === 'Gecko' || engine === 'Clecko') {
let pattern = '[ ](?:rv[: ]([0-9.]+))';
let pattern = '[ ](?:rv[: ])([0-9.]+)';
let regexp = new RegExp(pattern, 'i');
let match = regexp.exec(userAgent);
if (match !== null) {
return match.pop();
if (match !== null && /(?:g|cl)ecko\/[0-9]{8,10}/i.test(userAgent)) {
return match[1];
}
}

Expand All @@ -430,7 +429,7 @@ class Browser extends ClientAbstractParser {

let match = regexp.exec(userAgent);
if (match !== null) {
return match.pop();
return match[1]
}
return '';
}
Expand Down

0 comments on commit b34fd69

Please sign in to comment.