<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -162,13 +162,16 @@ Attacklab.wmdBase = function(){
 		
 		// Replace the flags with empty space and store them.
 		// Technically, this can match incorrect flags like &quot;gmm&quot;.
-		pattern = pattern.replace(/\/([gim]*)$/, &quot;&quot;);
-		if (re.lastMatch !== &quot;/&quot;) {
-			flags = re.$1;
+		var result = pattern.match(/\/([gim]*)$/);
+		if (result === null) {
+			flags = result[0];
+		}
+		else {
+			flags = &quot;&quot;;
 		}
 		
-		// Remove the slash delimiters on the regular expression.
-		pattern = pattern.replace(/(^\/|\/$)/g, &quot;&quot;);
+		// Remove the flags and slash delimiters from the regular expression.
+		pattern = pattern.replace(/(^\/|\/[gim]*$)/g, &quot;&quot;);
 		pattern = pre + pattern + post;
 		
 		return new RegExp(pattern, flags);</diff>
      <filename>wmd.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e5365c0affc18383f63b2fd30f79108ce0eb4303</id>
    </parent>
  </parents>
  <author>
    <name>derobins</name>
    <email>dana.e.robinson@gmail.com</email>
  </author>
  <url>http://github.com/derobins/wmd/commit/46cb1896bc66d3b96782c2be9c32d7b6b35789f3</url>
  <id>46cb1896bc66d3b96782c2be9c32d7b6b35789f3</id>
  <committed-date>2009-02-25T04:18:09-08:00</committed-date>
  <authored-date>2009-02-25T04:18:09-08:00</authored-date>
  <message>Ok.  I really fixed that regex extension bug this time.

You can't grab groups in string.replace() that way :/</message>
  <tree>32ced7776986c1ffe4861942b8fdadd8f357fd80</tree>
  <committer>
    <name>derobins</name>
    <email>dana.e.robinson@gmail.com</email>
  </committer>
</commit>
