diff --git a/pathologic.module b/pathologic.module
index 106d618..6454fcf 100644
--- a/pathologic.module
+++ b/pathologic.module
@@ -64,6 +64,13 @@ function _pathologic_settings($form, &$form_state, $filter, $format, $defaults)
         '#description' => t('If this site is or was available at more than one base path or URL, enter them here, separated by line breaks. For example, if this site is live at <code>http://example.com/</code> but has a staging version at <code>http://dev.example.org/staging/</code>, you would enter both those URLs here. If confused, please read <a href="!docs">Pathologic&rsquo;s documentation</a> for more information about this option and what it affects.', array('!docs' => 'http://drupal.org/node/257026')),
       '#weight' => 20,
     ),
+    'exclude_regex' => array(
+      '#type' => 'textarea',
+      '#title' =>  t('Regex for URLs that should not be processed'),
+      '#default_value' => isset($filter->settings['exclude_regex']) ? $filter->settings['exclude_regex'] : $defaults['exclude_regex'],
+      '#description' => t('Exclude URLs that match this expression'),
+      '#weight' => 30,
+    ),
   );
 }
 
@@ -180,6 +187,14 @@ function _pathologic_replace($matches) {
   if (strpos($matches[2], '//') === 0) {
     return $matches[0];
   }
+  
+  // Check if the path should be excluded from processing
+  if (!empty($settings['current_settings']['exclude_regex'])) {
+    if (preg_match($settings['current_settings']['exclude_regex'], $matches[2])) {
+      return $matches[0];
+    }
+  }
+  
   // Now parse the URL after reverting HTML character encoding.
   // @see http://drupal.org/node/1672932
   $parts = parse_url(htmlspecialchars_decode($matches[2]));
