Skip to content

Commit fa1b42b

Browse files
authored
fix(checkver): Correct variable 'regex' to 'regexp' (#5993)
1 parent 700a2f4 commit fa1b42b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- **scoop-download|install|update:** Use consistent options ([#5956](https://github.com/ScoopInstaller/Scoop/issues/5956))
1717
- **core:** Fix "Invoke-ExternalCommand" quoting rules ([#5945](https://github.com/ScoopInstaller/Scoop/issues/5945))
1818
- **scoop-info:** Fix download size estimating ([#5958](https://github.com/ScoopInstaller/Scoop/issues/5958))
19+
- **checkver:** Correct variable 'regex' to 'regexp' ([#5993](https://github.com/ScoopInstaller/Scoop/issues/5993))
1920

2021
### Code Refactoring
2122

bin/checkver.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ while ($in_progress -gt 0) {
275275
$ver = $Version
276276

277277
if (!$ver) {
278-
if (!$regex -and $replace) {
278+
if (!$regexp -and $replace) {
279279
next "'replace' requires 're' or 'regex'"
280280
continue
281281
}
@@ -300,7 +300,7 @@ while ($in_progress -gt 0) {
300300

301301
if ($jsonpath) {
302302
# Return only a single value if regex is absent
303-
$noregex = [String]::IsNullOrEmpty($regex)
303+
$noregex = [String]::IsNullOrEmpty($regexp)
304304
# If reverse is ON and regex is ON,
305305
# Then reverse would have no effect because regex handles reverse
306306
# on its own
@@ -348,19 +348,19 @@ while ($in_progress -gt 0) {
348348
}
349349

350350
if ($regexp) {
351-
$regex = New-Object System.Text.RegularExpressions.Regex($regexp)
351+
$re = New-Object System.Text.RegularExpressions.Regex($regexp)
352352
if ($reverse) {
353-
$match = $regex.Matches($page) | Select-Object -Last 1
353+
$match = $re.Matches($page) | Select-Object -Last 1
354354
} else {
355-
$match = $regex.Matches($page) | Select-Object -First 1
355+
$match = $re.Matches($page) | Select-Object -First 1
356356
}
357357

358358
if ($match -and $match.Success) {
359359
$matchesHashtable = @{}
360-
$regex.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
360+
$re.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
361361
$ver = $matchesHashtable['1']
362362
if ($replace) {
363-
$ver = $regex.Replace($match.Value, $replace)
363+
$ver = $re.Replace($match.Value, $replace)
364364
}
365365
if (!$ver) {
366366
$ver = $matchesHashtable['version']

0 commit comments

Comments
 (0)