Skip to content

Commit

Permalink
Add explainer for glob regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIPv4 committed Jan 18, 2024
1 parent ab1066c commit 4402973
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rules/embeds/glob.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ module.exports = md => {
if (closingMark === -1) return false;

// Check for glob match
const match = currentLines.slice(0, closingMark + 3).match(/^\[glob (.+?(?:(?: [^ \n]+?)+|(?:\n.+?)+))\](?:$|\n)/);
// .+(?:\n.+)+ allows for a glob with spaces on the first line, and then tests separated by newlines
// [^ \n]+(?: [^ \n]+)+ allows for a glob with no spaces on the first line, and then tests separated by spaces
const match = currentLines.slice(0, closingMark + 3).match(/^\[glob (.+(?:\n.+)+|[^ \n]+(?: [^ \n]+)+)\](?:$|\n)/);
if (!match) return false;

// Get the full strings
Expand Down

0 comments on commit 4402973

Please sign in to comment.