[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-bugs
Subject:    [Bug 107985] Regular expressions do not work in Find in files
From:       kdevelop-bugs-admin () barney ! cs ! uni-potsdam ! de
Date:       2006-03-14 21:01:25
Message-ID: 20060314210125.29147.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=107985         
adymo kdevelop org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From adymo kdevelop org  2006-03-14 22:01 -------
SVN commit 518666 by dymo:

Applied patch from simon at munton.demon.co.uk:
Attached patch adds a checkbox to allow pattern to be a regular
expression. 
Also gets rid of excessive single apostrophe escaping. 
Adds | to the list of characters to be escaped when the pattern is not a 
 regular expression. 

BUG: 107985



 M  +5 -0      grepdlg.cpp  
 M  +3 -0      grepdlg.h  
 M  +5 -4      grepviewwidget.cpp  


--- branches/kdevelop/3.4/parts/grepview/grepdlg.cpp #518665:518666
 @ -153,6 +153,11  @
     QBoxLayout *dir_checks_layout = new QHBoxLayout(4);
     layout->addLayout(dir_checks_layout, 4, 1);
 	
+    regexp_box = new QCheckBox(i18n("Regular &Expression"), this);
+    regexp_box->setChecked(true);
+    dir_checks_layout->addSpacing(10);
+    dir_checks_layout->addWidget(regexp_box);
+
     recursive_box = new QCheckBox(i18n("&Recursive"), this);
     recursive_box->setChecked(config->readBoolEntry("recursive", true));
     dir_checks_layout->addSpacing(10);
--- branches/kdevelop/3.4/parts/grepview/grepdlg.h #518665:518666
 @ -48,6 +48,8  @
     QString directoryString() const
 	{ return dir_combo->currentText(); }
 	
+	bool regexpFlag() const
+		{ return regexp_box->isChecked(); }
 	bool recursiveFlag() const
 		{ return recursive_box->isChecked(); }
 	bool ignoreSCMDirsFlag() const
 @ -74,6 +76,7  @
     KComboBox * dir_combo;
     KURLRequester * url_requester;
 
+    QCheckBox *regexp_box;
     QCheckBox *recursive_box;
     QCheckBox *ignore_scm_box;
     QCheckBox *case_sens_box;
--- branches/kdevelop/3.4/parts/grepview/grepviewwidget.cpp #518665:518666
 @ -158,7 +158,7  @
 //  todo - put this somewhere common - or just use Qt if possible
 static QString escape(const QString &str)
 {
-	QString escaped("[]{}()\\^$?.+-*");
+	QString escaped("[]{}()\\^$?.+-*|");
 	QString res;
 
 	for (uint i=0; i < str.length(); ++i)
 @ -213,9 +213,10  @
 
 	m_lastPattern = grepdlg->patternString();
 	QString pattern = grepdlg->templateString();
-	//    pattern.replace(QRegExp("%s"), grepdlg->patternString());
-	pattern.replace(QRegExp("%s"), escape( grepdlg->patternString() ) );
-	pattern.replace(QRegExp("'"), "'\\''");
+	if (grepdlg->regexpFlag())
+	    pattern.replace(QRegExp("%s"), grepdlg->patternString());
+        else
+	    pattern.replace(QRegExp("%s"), escape( grepdlg->patternString() ) );
 
 	QString filepattern = "find ";
 	filepattern += KShellProcess::quote(grepdlg->directoryString());


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic