title: How to convert a wildcard pattern to regex in Erlang?
body: <p>Wildcard patterns are file system standards that match any characters to a ( ? ) and any sequence characters to an ( * ). </p>
  
  <p>I am trying to use the erlang <a href="http://www.erlang.org/doc/man/re.html#replace-3" rel="nofollow">re:replace/3</a> function to replace:</p>
  
  <p>a)  <code>*</code> into <code>.*</code></p>
  
  <p>b)  <code>?</code> into <code>.</code></p>
  
  <p>c)  <code>.</code> into <code>\.</code></p>
  
  <p>d)  if a wildcard pattern does not start in a wildcard, then add a <code>^</code> (start-match in regex) to the end of the pattern</p>
  
  <p>e)  if a wildcard pattern does not end in a wildcard, then add a <code>$</code> (end-match in regex) to the end of the pattern</p>
  
  <p>Somehow I am unable to get the re:replace to achieve this. </p>
  
  <p>Examples:</p>
  
  <p>trying to replace based on item a) above</p>
  
  <pre><code>re:replace("something*.log","\*","\.\*").
  exception error: bad argument
  </code></pre>