Click here to Skip to main content
15,893,594 members
Articles / Desktop Programming / MFC

Notepad RE (Regular Expressions)

Rate me:
Please Sign up or sign in to vote.
4.68/5 (107 votes)
22 Mar 2011CPOL9 min read 842.7K   8.5K   234  
Search and replace text in Notepad RE using Regular Expressions or normal mode. The editor supports drag and drop, file change notifications, and displays the line and column numbers. Unicode support is available too.
#if !defined(AFX_REGEXSYNTAXDLG_H__5A7736E1_55F2_4242_AD34_CADA03B708AF__INCLUDED_)
#define AFX_REGEXSYNTAXDLG_H__5A7736E1_55F2_4242_AD34_CADA03B708AF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// RegexSyntaxDlg.h : header file
//
#pragma warning (disable:4786)

#include <boost/regex.hpp>

/////////////////////////////////////////////////////////////////////////////
// CRegexSyntaxDlg dialog

class CRegexSyntaxDlg : public CDialog
{
// Construction
public:
	CRegexSyntaxDlg (const boost::regbase::flag_type tSyntax,
		const unsigned int uiMatchFlags, CWnd* pParent = NULL);

	boost::regex_constants::syntax_option_type m_tSyntax;
	boost::match_flag_type m_uiMatchFlags;

// Dialog Data
	//{{AFX_DATA(CRegexSyntaxDlg)
	enum { IDD = IDD_REGEX_SYNTAX };
	int		m_iSyntax;
	BOOL	m_bno_bk_refs;
	BOOL	m_bno_perl_ex;
	BOOL	m_bno_mod_m;
	BOOL	m_bmod_x;
	BOOL	m_bmod_s;
	BOOL	m_bno_mod_s;
	BOOL	m_bno_char_classes;
	BOOL	m_bno_intervals;
	BOOL	m_bbk_plus_qm;
	BOOL	m_bbk_vbar;
	BOOL	m_bemacs_ex;
	BOOL	m_bno_escape_in_lists;
	BOOL	m_bnewline_alt;
	BOOL	m_bcollate;
	BOOL	m_bnosubs;
	BOOL	m_bmatch_not_dot_newline;
	BOOL	m_bmatch_not_dot_null;
	BOOL	m_bmatch_any;
	BOOL	m_bmatch_not_null;
	BOOL	m_bmatch_continuous;
	BOOL	m_bmatch_extra;
	BOOL	m_bmatch_single_line;
	BOOL	m_bformat_perl;
	BOOL	m_bformat_sed;
	BOOL	m_bformat_all;
	BOOL	m_bformat_first_only;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRegexSyntaxDlg)
	protected:
	virtual void DoDataExchange (CDataExchange *pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CRegexSyntaxDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnRadioNone();
	afx_msg void OnRadioBasic();
	afx_msg void OnRadioExtended();
	afx_msg void OnRadioPerl();
	afx_msg void OnRadioEmacs();
	afx_msg void OnRadioAwk();
	afx_msg void OnRadioGrep();
	afx_msg void OnRadioEgrep();
	afx_msg void OnOk ();
	afx_msg BOOL OnHelpInfo (HELPINFO *pHelpInfo);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

private:
	void ClearDisabledSyntaxFlags ();
	void ClearDisablePerlFlags ();
	void ClearDisableBasicFlags ();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_REGEXSYNTAXDLG_H__5A7736E1_55F2_4242_AD34_CADA03B708AF__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
I started programming in 1983 using Sinclair BASIC, then moved on to Z80 machine code and assembler. In 1988 I programmed 68000 assembler on the ATARI ST and it was 1990 when I started my degree in Computing Systems where I learnt Pascal, C and C++ as well as various academic programming languages (ML, LISP etc.)

I have been developing commercial software for Windows using C++ since 1994.

Comments and Discussions