Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### 1.1.1 Sep 4, 2025
- Fixes a bug where RegExp with global modifier doesn't replace groups
### 1.1.0 Sep 3, 2025
- Allow Regex groups to be used in replacement
### 1.0.8 Aug 28, 2024
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "link-magic",
"name": "LinkMagic",
"version": "1.1.0",
"version": "1.1.1",
"minAppVersion": "0.15.0",
"description": "Automatically adds links to defined regex.",
"author": "Andrew Reifman",
Expand Down
2 changes: 2 additions & 0 deletions replacePattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export function replacePattern(target: string, pattern: RegExp, innerWord: strin
* @returns An array of [groupName, replacement] tuples
*/
function findGroups(input: string, pattern: RegExp): string[][] {
// Due to the global flag keeping track of the lastIndex, we need to reset the pattern here
pattern.lastIndex = 0;
const matches = pattern.exec(input);
if (!matches) {
return [];
Expand Down