I want to write a checker to check if there are any invalid characters,
The user will write their rules in JSON file,
And I need to follow their rules than check if the text file has any invalid characters.
I need to define the rule in JSON ,
"range":["A-Z,a-z,0-9,!#$%-.@ ^_~\/;:?{[]}`*)(+|"]
The user may define their rule like the above rule,
In human view, we can know A-Z
means A,B,...,Z
And !#$%-.@ ^_~\/;:?{[]}*)(+|
means each character defines them self.
What's the good way , good practice to write the DSL in JSON file and be parsed by RUBY.
For example, how could I know the input rule is regular expression
or general character
in the RUBY program ? because when I load the JSON file, the program will see it as plain text.