Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: vmlobanov78 on February 12, 2012, 04:27:08 AM

Poll
Question: Please change
Option 1: ReplaceInFiles votes: 0
Option 2: EditorManager votes: 0
Title: EditorManager::ReplaceInFiles
Post by: vmlobanov78 on February 12, 2012, 04:27:08 AM
In File:        sdk/editormanager.cpp
In Function:  int EditorManager::ReplaceInFiles(cbFindReplaceData* data)

From:

fileContents = cbReadFileContents(file, def_encoding);
if (fileContents.Find(data->findText) == -1)
{
continue;
}

To:

fileContents = cbReadFileContents(file, def_encoding);
if(!data->regEx)
{
if (fileContents.Find(data->findText) == -1)
{
continue;
}
}else if( AdvRegex && re.Matches(fileContents)==0)
{
continue;
}
Title: Re: EditorManager::ReplaceInFiles
Post by: MortenMacFly on February 12, 2012, 09:26:22 AM
Quote from: vmlobanov78 on February 12, 2012, 04:27:08 AM
In File:        sdk/editormanager.cpp
In Function:  int EditorManager::ReplaceInFiles(cbFindReplaceData* data)
I don't understand what you are trying to tell...?!

Can you please explain what you show here and not just post code snippets?
Title: Re: EditorManager::ReplaceInFiles
Post by: ptDev on February 12, 2012, 10:21:01 AM
Is regular expression replace in files broken?
Title: Re: EditorManager::ReplaceInFiles
Post by: vmlobanov78 on February 12, 2012, 11:46:18 AM
Quote from: ptDev on February 12, 2012, 10:21:01 AM
Is regular expression replace in files broken?

Yes.

I'm from Russia. I don't speak English.

First code ("From") place - string number ~ 1980-1990 in file sdk/editormanager.cpp
Title: Re: EditorManager::ReplaceInFiles
Post by: Jenna on February 12, 2012, 01:05:17 PM
Can you tell us, what you expect and what does not work.
Title: Re: EditorManager::ReplaceInFiles
Post by: vmlobanov78 on February 12, 2012, 02:43:03 PM
When I want to do "Replace in files" with options: "Regular expression" and  scope "Projects files" or "Workspace files"

In closed files does not result.
Because:
fileContents.Find(data->findText) == -1
with "RegExp" can produce results "true"