Skip to content

Commit

Permalink
Regexp replace \N freeze #163
Browse files Browse the repository at this point in the history
  • Loading branch information
cshnik committed May 29, 2018
1 parent 0d3b832 commit 6d5319a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Binary file modified bin/Notepad2e.exe
Binary file not shown.
14 changes: 11 additions & 3 deletions scintilla/boostregex/BoostRegExSearch.cxx
Expand Up @@ -259,9 +259,10 @@ long BoostRegexSearch::FindText(Document* doc, int startPosition, int endPositio
const bool isUtf8 = (doc->CodePage() == SC_CP_UTF8);
search._compileFlags =
regex_constants::ECMAScript
| (caseSensitive ? 0 : regex_constants::icase);
| (caseSensitive ? 0 : regex_constants::icase)
| regex_constants::no_except;
search._regexString = regexString;
search._boostRegexFlags = regex_constants::match_default;
search._boostRegexFlags = regex_constants::match_default;

Match match =
isUtf8 ? _utf8.FindText(search)
Expand Down Expand Up @@ -306,7 +307,14 @@ BoostRegexSearch::Match BoostRegexSearch::EncodingDependent<CharT, CharacterIter
search._boostRegexFlags = search.isLineStart(lineRange.start)
? search._boostRegexFlags & ~regex_constants::match_not_bol
: search._boostRegexFlags | regex_constants::match_not_bol;
found = boost::regex_search(itStart, itEnd, _match, _regex, search._boostRegexFlags);
try
{
found = boost::regex_search(itStart, itEnd, _match, _regex, search._boostRegexFlags);
}
catch (...)
{
found = false;
}
if (found) {
const int position = _match[0].first.pos();
const int length = _match[0].second.pos() - position;
Expand Down
4 changes: 2 additions & 2 deletions src/Extension/EditHelperEx.cpp
@@ -1,5 +1,5 @@
#include "EditHelperEx.h"
#include <regex>
#include <boost/regex.hpp>
#include "../scintilla/src/UniConversion.h"

extern "C"
Expand Down Expand Up @@ -174,7 +174,7 @@ extern "C"
{
try
{
std::regex reg(str);
boost::regex reg(str, boost::regex_constants::ECMAScript);
return 1;
}
catch (...)
Expand Down

0 comments on commit 6d5319a

Please sign in to comment.