This regular expression expects 7 potential matches.

1: The whole string
2: the alias name
3 & 4: the command text in two locations
5 & 6: the quoted command text in two styles
7: the group that selects between the two qoted styles.
This commit is contained in:
FaintSpeaker 2021-12-29 13:56:26 -05:00
parent 91243f4742
commit 7a0fdb9ce9

@ -38,7 +38,7 @@ export function printAliases(): void {
export function parseAliasDeclaration(dec: string, global = false): boolean { export function parseAliasDeclaration(dec: string, global = false): boolean {
const re = /^([\w|!|%|,|@|-]+)=(("(.+)")|('(.+)'))$/; const re = /^([\w|!|%|,|@|-]+)=(("(.+)")|('(.+)'))$/;
const matches = dec.match(re); const matches = dec.match(re);
if (matches == null || matches.length != 3) { if (matches == null || matches.length != 7) {
return false; return false;
} }
if (global) { if (global) {