Index: src/components/org/apache/jmeter/extractor/RegexExtractor.java
===================================================================
--- src/components/org/apache/jmeter/extractor/RegexExtractor.java	(revision 1588500)
+++ src/components/org/apache/jmeter/extractor/RegexExtractor.java	(working copy)
@@ -23,7 +23,9 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.jmeter.assertions.AssertionResult;
 import org.apache.jmeter.processor.PostProcessor;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.AbstractScopedTestElement;
@@ -84,6 +86,10 @@
 
     private static final String UNDERSCORE = "_";  // $NON-NLS-1$
 
+    private static final String FAILIFNOTFOUND = "RegexExtractor.fail_if_not_found";
+    
+    private static final String FAILMESSAGE = "RegexExtractor.fail_message";
+    
     private transient List<Object> template;
 
     /**
@@ -117,6 +123,10 @@
         try {
             pattern = JMeterUtils.getPatternCache().getPattern(regex, Perl5Compiler.READ_ONLY_MASK);
             List<MatchResult> matches = processMatches(pattern, regex, previousResult, matchNumber, vars);
+            
+            if(matches.isEmpty() && isFailIfNotFound()){
+                failResult(previousResult);
+            }
             int prevCount = 0;
             String prevString = vars.get(refName + REF_MATCH_NR);
             if (prevString != null) {
@@ -169,6 +179,14 @@
         }
     }
 
+    private void failResult(SampleResult previousResult){
+        previousResult.setSuccessful(false);
+        AssertionResult res = new AssertionResult(getName());
+        res.setFailure(true);
+        res.setFailureMessage(StringUtils.defaultIfEmpty(getFailMessage(), "Pattern not found - " + getRegex()));
+        previousResult.addAssertionResult(res);
+    }
+    
     private String getInputString(SampleResult result) {
         String inputString = useUrl() ? result.getUrlAsString() // Bug 39707
                 : useHeaders() ? result.getResponseHeaders()
@@ -469,4 +487,21 @@
     public void setUseField(String actionCommand) {
         setProperty(MATCH_AGAINST,actionCommand);
     }
+    
+    public void setFailIfNotFound(Boolean isFailing){
+        log.warn("Setting fail as " + isFailing);
+        setProperty(FAILIFNOTFOUND,isFailing);
+    }
+    
+    public boolean isFailIfNotFound(){
+        return getPropertyAsBoolean(FAILIFNOTFOUND);
+    }
+    
+    public void setFailMessage(String message){
+        setProperty(FAILMESSAGE, message);
+    }
+    
+    public String getFailMessage(){
+        return getPropertyAsString(FAILMESSAGE);
+    }
 }
Index: src/components/org/apache/jmeter/extractor/gui/RegexExtractorGui.java
===================================================================
--- src/components/org/apache/jmeter/extractor/gui/RegexExtractorGui.java	(revision 1588500)
+++ src/components/org/apache/jmeter/extractor/gui/RegexExtractorGui.java	(working copy)
@@ -26,6 +26,7 @@
 import javax.swing.BorderFactory;
 import javax.swing.Box;
 import javax.swing.ButtonGroup;
+import javax.swing.JCheckBox;
 import javax.swing.JComponent;
 import javax.swing.JPanel;
 import javax.swing.JRadioButton;
@@ -68,6 +69,10 @@
     private JRadioButton useMessage;
 
     private ButtonGroup group;
+    
+    private JCheckBox failResult;
+    
+    private JLabeledTextField failMessage;
 
     public RegexExtractorGui() {
         super();
@@ -97,6 +102,8 @@
             defaultField.setText(re.getDefaultValue());
             matchNumberField.setText(re.getMatchNumberAsString());
             refNameField.setText(re.getRefName());
+            failResult.setSelected(re.isFailIfNotFound());
+            failMessage.setText(re.getFailMessage());
         }
     }
 
@@ -127,6 +134,8 @@
             regex.setTemplate(templateField.getText());
             regex.setDefaultValue(defaultField.getText());
             regex.setMatchNumber(matchNumberField.getText());
+            regex.setFailIfNotFound(failResult.isSelected());
+            regex.setFailMessage(failMessage.getText());
         }
     }
 
@@ -154,10 +163,21 @@
         box.add(makeTitlePanel());
         box.add(createScopePanel(true));
         box.add(makeSourcePanel());
+        box.add(makeNotMatch());
         add(box, BorderLayout.NORTH);
         add(makeParameterPanel(), BorderLayout.CENTER);
     }
 
+    private JPanel makeNotMatch(){
+        JPanel panel = new JPanel(new BorderLayout(5, 0));
+        panel.setBorder(BorderFactory.createTitledBorder("Matching options"));
+        failResult = new JCheckBox("Fail if nothing found with message");
+        failMessage = new JLabeledTextField();
+        panel.add(failResult, BorderLayout.WEST);
+        panel.add(failMessage, BorderLayout.CENTER);
+        return panel;
+    }
+    
     private JPanel makeSourcePanel() {
         JPanel panel = new JPanel();
         panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("regex_source"))); //$NON-NLS-1$
