Template language for random string generation

Ian Kelly ian.g.kelly at gmail.com
Sat Aug 9 03:49:54 EDT 2014


On Sat, Aug 9, 2014 at 12:52 AM, Paul Wolf <paulwolf333 at gmail.com> wrote:
> On Friday, 8 August 2014 23:03:18 UTC+1, Ian  wrote:
>> Have you given any thought to adding a validation mode, where the user
>> provides a template and a string and wants to know if the string
>> matches the template?
>
> Isn't that what regular expressions are? Or do you have a clarifying use case?
>
> strgen is provided as the converse of regular expressions.

The syntax is not equivalent though. You can't take a strgen template,
pass it into the re module, and just expect it to work.

Also, I'm not sure how best to go about writing a regular expression
for, e.g. "12 or more letters, digits, and punctuation, including at
least one each of uppercase letter, lowercase letter, digit, and
punctuation". I'm fairly certain that language is regular, but
actually matching it with a regular expression would be a nightmare.



More information about the Python-list mailing list