Skip to content

Commit

Permalink
Convert PCRE \A and \Z
Browse files Browse the repository at this point in the history
  • Loading branch information
Nixinova committed Aug 13, 2021
1 parent 02ba514 commit 9b32d48
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Next
## 1.5.1
*2021-08-14*
- Fixed PCRE regular expressions causing a crash.
- Fixed shebang lines not being fully checked.
- Fixed heuristics with two fallback languages not choosing just one of them.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linguist-js",
"version": "1.5.0",
"version": "1.5.1",
"description": "Analyse languages used in a folder. Powered by GitHub Linguist, although it doesn't need to be installed.",
"main": "dist/index.js",
"bin": {
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function pcre(regex: string): RegExp {
finalRegex = finalRegex.replace(match, '');
[...flags].forEach(flag => finalFlags.add(flag));
}
finalRegex = finalRegex.replace(/([*+]){2}/g, '$1');
finalRegex = finalRegex
.replace(/([*+]){2}/g, '$1') // ++ and *+ modifiers
.replace(/\\A/g, '^').replace(/\\Z/g, '$') // start- and end-of-file markers
return RegExp(finalRegex, [...finalFlags].join(''));
}

Expand Down

0 comments on commit 9b32d48

Please sign in to comment.