What’s the easiest way of me converting the simpler regex format that most users are used to into the correct re python regex string?
As an example, I need to convert this:
string = '*abc+de?'
to this:
string = '.*abc.+de.?'
Of course I could loop through the string and build up another string character by character, but that’s surely an inefficient way of doing this?
Those don’t look like regexps you’re trying to translate, they look more like unix shell globs. Python has a module for doing this already. It doesn’t know about the ‘+’ syntax you used, but neither does my shell, and I think the syntax is nonstandard.