Update regex pattern to allow Clients.

pull/1959/head
n8225 5 years ago
parent 9f8668afc9
commit 14c870daec

@ -16,30 +16,9 @@ function split(text) { // Function to split lines into array
return text.split(/\r?\n/); return text.split(/\r?\n/);
} }
function findPattern(text) { // Test entries against 8 patterns. If matches pattern returns true function findPattern(text) { // All entries should match this pattern. If matches pattern returns true.
const nodnospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. `.*?` `.*?`/; // Regex for entries with no demo and no source code const patt = /^\s{0,2}-\s\[.*?\]\(.*?\) (`⚠` )?- .{0,249}?\.( \(\[(Demo|Source Code|Clients)\]\([^)]*\)(, \[(Source Code|Clients)\]\([^)]*\))?(, \[(Source Code|Clients)\]\([^)]*\))*\))? \`.*?\` \`.*?\`$/;
const slpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Demo\b\]\(.*?\), \[Source Code\b\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with demo and source code if (patt.test(text) === true) {
const nodpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Source Code\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with no demo
const nospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Demo\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with no source code
const pnodnospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. `.*?` `.*?`/; // Regex for entries with proprietary with no demo and no source code
const pslpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Demo\b\]\(.*?\), \[Source Code\b\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with demo and source code
const pnodpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Source Code\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with no demo
const pnospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Demo\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with no source code
if (nodnospatt.test(text) === true) {
return true;
} else if (slpatt.test(text) === true) {
return true;
} else if (nodpatt.test(text) === true) {
return true;
} else if (nospatt.test(text) === true) {
return true;
} else if (pnodnospatt.test(text) === true) {
return true;
} else if (pslpatt.test(text) === true) {
return true;
} else if (pnodpatt.test(text) === true) {
return true;
} else if (pnospatt.test(text) === true) {
return true; return true;
} }
return false; return false;
@ -59,7 +38,7 @@ function entryErrorCheck(md) {
for (let i = 0, len = entries.length; i < len; i += 1) { // Loop to create array of objects for (let i = 0, len = entries.length; i < len; i += 1) { // Loop to create array of objects
entryArray[i] = new Object; entryArray[i] = new Object;
entryArray[i].raw = entries[i]; entryArray[i].raw = entries[i];
if (entryFilter(entries[i]) === true) { // filter out lines that don't with * [) if (entryFilter(entries[i]) === true) { // filter out lines that don't start with * [)
total += 1; total += 1;
entryArray[i].name = namepatt.exec(entries[i])[1]; // Parses name of entry entryArray[i].name = namepatt.exec(entries[i])[1]; // Parses name of entry
entryArray[i].pass = findPattern(entries[i]); // Tests against known patterns entryArray[i].pass = findPattern(entries[i]); // Tests against known patterns

Loading…
Cancel
Save