Skip to content

Commit

Permalink
fix: revert regex change for variable parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
benib committed Apr 18, 2024
1 parent 62b6756 commit bed987a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/models/Paragraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ export default class Paragraph {
}
}

const variableRegExp = /\{(?<type>string|number|tel|email|date)?(?::)?(?<name>[a-zA-Z]{1,})(?::)?(?<label>[^:}]{0,})\}/g;
// this line would allow Umlauts and , and other characters in variable labels but is not really tested well enough
//const variableRegExp = /\{(?<type>string|number|tel|email|date)?(?::)?(?<name>[a-zA-Z]{1,})(?::)?(?<label>[^:}]{0,})\}/g;

// this line has been in place since the beginning of the generator and is well tested
const variableRegExp = /\{(?<type>string|number|tel|email|date)?(?::)?(?<name>[a-zA-Z]{1,})(?::)?(?<label>[a-zA-Z-. ]{0,})\}/g;

function getVariablesFromString(string) {
const matches = [...string.matchAll(variableRegExp)]
return matches
Expand Down

0 comments on commit bed987a

Please sign in to comment.