@Override
	public void actionPerformed(ActionEvent evt) {
        
        try {
            boolean b;
            Regex r = new Regex(txtRegex.getText());

            if(evt.getSource() == btnDemo){
            	//random generation
            	setTextareaRandomly(lstrExamples);
            	b = true;
            }
            else if (evt.getSource() == btnExact) {
                b = r.match(txtInput.getText());
            } else if (evt.getSource() == btnStart) {
                b = r.matchFromStart(txtInput.getText());
            } else {
                b = r.presentInSequence(txtInput.getText()) >= 0;
            } // else
            
            if (b) {
                txtAnswer.setText(r.getReplacement());
            } else {
                txtAnswer.setText("// Not matched!");
            } // else
        } catch (Exception e) {
            txtAnswer.setText("// Exception!");
            return;
        } // catch

    } // actionPerformed