<p>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?</p>

<p>As an example, I need to convert this:</p>

<pre><code>string = "*abc+de?"
</code></pre>

<p>to this:</p>

<pre><code>string = ".*abc.+de.?"
</code></pre>

<p>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?</p>

I'd use
```
replace
```
:
```
```
def wildcard_to_regex(str):
    return str.replace("*", ".*").replace("?", .?").replace("#", "\d")
```
```
This probably isn't the most efficient way but it should be efficient enough for most purposes. Notice that some wildcard formats allow character classes which are more difficult to handle.