Type definitions used for code clarity.
Compilation options.
Definition at line 84 of file regexp.hpp.
◆ TFlags ◆ TMatch ◆ TOffset ◆ TVarList ◆ TVarMap ◆ ECompileFlags for compile regular expressions.
PCRE compiler flags used in the constructor and in Set(). If fCompile_ignore_case is set, matches are case insensitive. If fCompile_dotall is set, a dot meta-character in the pattern matches all characters, including newlines. Without it, newlines are excluded. If fCompile_newline is set then ^ matches the start of a line and $ matches the end of a line. If not set, ^ matches only the start of the entire string and $ matches only the end of the entire string. If fCompile_ungreedy inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by "?". It is not compatible with Perl.
The settings can be changed from within the pattern by a sequence of Perl option letters enclosed between "(?" and ")". The option letters are: i for PCRE_CASELESS m for PCRE_MULTILINE s for PCRE_DOTALL x for PCRE_EXTENDED U for PCRE_UNGREEDY
Enumerator fCompile_default fCompile_ignore_case fCompile_dotall fCompile_newline fCompile_ungreedy fCompile_extendedDefinition at line 109 of file regexp.hpp.
◆ ECompile_deprecated Enumerator eCompile_default eCompile_ignore_case eCompile_dotall eCompile_newline eCompile_ungreedyDefinition at line 118 of file regexp.hpp.
◆ EErrCode [1/2] Enumerator eCompile eBadFlagsDefinition at line 555 of file regexp.hpp.
◆ EErrCode [2/2]Error types that tester can generate.
Enumerator eOpenFilefile open error
eMismatchLengthfile/template line number mismatch
eMismatchContentfile/template lines do not match
eVarNotFoundvariable not found
eVarErrvariable definition error
eOpUnknownunknown operation
eOpErroperation definition error
eOpTest'test' operation return FALSE
Definition at line 357 of file regexp_template_tester.hpp.
◆ EFlags Enumerator fSkipEmptySourceLinesSkip empty lines in the source.
fSkipEmptyTemplateLinesSkip empty lines in the template.
fSkipEmptyLinesDefinition at line 204 of file regexp_template_tester.hpp.
◆ EMatchFlags for match string against a precompiled pattern.
Setting fMatch_not_begin causes ^ not to match before the first character of a line. Without setting fCompile_newline, ^ won't match anything if fMatch_not_begin is set. Setting fMatch_not_end causes $ not to match immediately before a new line. Without setting fCompile_newline, $ won't match anything if fMatch_not_end is set.
Enumerator fMatch_default fMatch_not_begin^ won't match string begin.
fMatch_not_end$ won't match string end.
fMatch_not_bothDefinition at line 134 of file regexp.hpp.
◆ EMatch_deprecated Enumerator eMatch_default eMatch_not_begin eMatch_not_end eMatch_not_bothDefinition at line 141 of file regexp.hpp.
◆ ERangeRange processing type.
Defines which part of the specified range should be processed.
Enumerator eInsideProcess substrings inside range.
eOutsideProcess substrings outside range.
Definition at line 447 of file regexp.hpp.
◆ EResult ◆ ESource ◆ ClearRange() void CRegexpUtil::ClearRange ( void ) inline ◆ Compare() [1/2] ◆ Compare() [2/2] void CRegexpTemplateTester::Compare ( istream & file_stream, istream & template_stream ) ◆ ConvertDateTo_iso8601() ◆ ConvertDateTo_iso8601_and_annotate() ◆ CRegexp() [1/2] ◆ CRegexp() [2/2]Constructor.
Set and compile the PCRE pattern specified by argument according to compile options. Also allocate memory for compiled PCRE.
Definition at line 111 of file regexp.cpp.
References flags, and CRegexp::Set().
◆ CRegexpTemplateTester() CRegexpTemplateTester::CRegexpTemplateTester ( TFlags flags =0
) ◆ CRegexpUtil() ◆ Escape() ◆ Exists() ◆ Extract() ◆ GetErrCodeString() [1/2] const char * CRegexpException::GetErrCodeString ( void ) const overridevirtual ◆ GetErrCodeString() [2/2] const char * CRegexpTemplateTesterException::GetErrCodeString ( void ) const overridevirtual ◆ GetMatch()
Get matching pattern and subpatterns.
Return a string corresponding to the match to pattern or subpattern. Set noreturn to true when GetSub() or GetResults() will be used to retrieve pattern and subpatterns. Calling GetMatch() causes the entire search to be performed again. If you want to retrieve a different pattern/subpattern from an already performed search, it is more efficient to use GetSub() or GetResults(). If you need to get numeric offset of the found pattern or subpattern, that use GetResults() method. Doo not use functions like strstr(), or string's find() method and etc, because in general they give you wrong results. This is very dependent from used regular expression.
Definition at line 242 of file regexp.cpp.
References flags, CRegexp::GetSub(), offset, str(), and CRegexp::x_Match().
Referenced by BrBookURLToCCddBookRef(), BrFcgiBookTermToEutilsTerm(), CapitalizeAfterApostrophe(), CPepXML::ConvertScanID(), DoesPatternMatchHighlightedResidues(), CRegexpUtil::Exists(), CRegexpUtil::Extract(), extract_date_iso8601(), CFindPattern::Find(), FixAffiliationShortWordsInElement(), FixOrdinalNumbers(), NMItemData::GetResolveFuncForPubQual(), CSpectrumSet::LoadMultDTA(), PortalBookURLToCCddBookRef(), CRegexpUtil::Replace(), CRegexpUtil::ReplaceRange(), NSearchFeatPanel::SplitPosOrRange(), transform_range(), CMsvcConfigure::WriteBuildVer(), CConvertAuthorToConsortiumWhereConstraint::x_ApplyToCAuth(), COrfSearchJob::x_DoSearch(), CSequenceSearchJob::x_GetMatches(), and CFeatureSearchJob::x_Match().
◆ GetResult() string CRegexpUtil::GetResult ( void ) inlineGet result string.
Definition at line 597 of file regexp.hpp.
References CRegexpUtil::m_Content, CRegexpUtil::m_IsDivided, and CRegexpUtil::x_Join().
Referenced by CapitalizeSAfterNumber(), CPhyObjectLoader::Execute(), FindReplaceString_CountryFixes(), FixAbbreviationsInElement(), FixAffiliationShortWordsInElement(), CFixProductNames::FixCaps(), FixCountryCapitalization(), FixKnownAbbreviationsInElement(), FixShortWordsInElement(), FixupMouseStrain(), InsertMissingSpacesAfterCommas(), InsertMissingSpacesAfterNo(), CFindASN1Dlg::ReplaceValue(), CMacroFunction_EditStringQual::s_EditText(), s_RegexpReplace(), and CMacroFunction_FixSpelling::s_SpellingFixes().
◆ GetResults()Get location of pattern/subpattern for the last GetMatch().
Definition at line 584 of file regexp.hpp.
References CRegexp::m_NumFound, and CRegexp::m_Results.
Referenced by CapitalizeAfterApostrophe(), CFindPattern::Find(), FixAffiliationShortWordsInElement(), FixOrdinalNumbers(), CNcbiApplogApp::GetRawAppName(), CRegexpUtil::Replace(), CNcbiApplogApp::Run(), and CSequenceSearchJob::x_GetMatches().
◆ GetSub() [1/2] ◆ GetSub() [2/2]Get pattern/subpattern from previous GetMatch().
Should only be called after GetMatch() has been called with the same string. GetMatch() internally stores locations on string where pattern and subpatterns were found.
Definition at line 200 of file regexp.cpp.
References CRegexp::m_NumFound, CRegexp::m_Results, PCRE2_SIZE, PCRE2_UNSET, and str().
Referenced by BrBookURLToCCddBookRef(), BrFcgiBookTermToEutilsTerm(), extract_date_iso8601(), CRegexp::GetMatch(), NMItemData::GetResolveFuncForPubQual(), CRegexp::GetSub(), PortalBookURLToCCddBookRef(), CReadBlastApp::ReadBlast(), s_ChrName(), CTabularFormatter::SetFormat(), sParseVersion(), NSearchFeatPanel::SplitPosOrRange(), transform_ambiguous_date(), transform_range(), CRegexpTemplateTester::x_CompareLines(), and CSeq_id_Resolver__LRG::x_Create().
◆ GetVar() ◆ GetVars() ◆ IsMatch()Check existence substring which match a specified pattern.
Using IsMatch() reset all results from previous GetMatch() call. The subsequent NumFound() always returns 1 for successful IsMatch().
Definition at line 253 of file regexp.cpp.
References flags, CRegexp::m_NumFound, str(), and CRegexp::x_Match().
Referenced by CSeq_id_Resolver::CanCreate(), CProjectsLstFileFilter::CheckProject(), CPepXML::ConvertScanID(), extract_date_iso8601(), NSearchFeatPanel::GatherFeatures(), CAssemblyInfo::IsSameAssembly(), CMaskRegexp::Match(), CFilterColumnsDlg::OnRangeTextctrlTextUpdated(), CReadBlastApp::ReadBlast(), CNcbiApplogApp::Redirect(), CNcbiApplogApp::Run(), s_ChrName(), s_IsAllDigits(), CTabularFormatter::SetFormat(), sParseVersion(), NSearchFeatPanel::SplitPosOrRange(), CRegexpTemplateFilter::TestAttribute(), transform_ambiguous_date(), transform_range(), CRegexpValidator::Validate(), CRemoveDescDlg::x_ApplyToSeq_entry(), CRegexpTemplateTester::x_CompareLines(), CFeatureCheckPanel::x_InitTree(), CPSGS_AnnotProcessor::x_IsNameValid(), CFeatureSearchJob::x_IsSNP(), CRegexpTemplateTester::x_Op_Test(), and CGenBankLoadOptionPanel::x_ProccessText().
◆ NCBI_EXCEPTION_DEFAULT() [1/2] ◆ NCBI_EXCEPTION_DEFAULT() [2/2] ◆ NumFound() int CRegexp::NumFound ( ) const inlineGet number of patterns + subpatterns.
Definition at line 577 of file regexp.hpp.
References CRegexp::m_NumFound.
Referenced by BrBookURLToCCddBookRef(), CapitalizeAfterApostrophe(), DoesPatternMatchHighlightedResidues(), CRegexpUtil::Exists(), FixAffiliationShortWordsInElement(), FixOrdinalNumbers(), PortalBookURLToCCddBookRef(), CRegexpUtil::Replace(), CRegexpUtil::ReplaceRange(), NSearchFeatPanel::SplitPosOrRange(), CConvertAuthorToConsortiumWhereConstraint::x_ApplyToCAuth(), CRegexpTemplateTester::x_CompareLines(), and CSequenceSearchJob::x_GetMatches().
◆ operator string() CRegexpUtil::operator string ( void ) inline ◆ operator=() [1/2] ◆ operator=() [2/2] ◆ PrintVar() void CRegexpTemplateTester::PrintVar ( const string & name ) const ◆ PrintVars() void CRegexpTemplateTester::PrintVars ( void ) const ◆ Replace()Replace occurrences of a substring within a string by pattern.
Definition at line 349 of file regexp.cpp.
References CTempString::assign(), count, CTempString::data(), CTempString::empty(), CRegexp::GetMatch(), CRegexp::GetResults(), int, kMax_Int, CTempString::length(), CRegexpUtil::m_Content, n, NPOS, CRegexp::NumFound(), result, rapidjson::value, and CRegexpUtil::x_Join().
Referenced by CapitalizeSAfterNumber(), CPhyObjectLoader::Execute(), FindReplaceString_CountryFixes(), FixAbbreviationsInElement(), FixAffiliationShortWordsInElement(), CFixProductNames::FixCaps(), FixCountryCapitalization(), FixKnownAbbreviationsInElement(), FixShortWordsInElement(), FixupMouseStrain(), InsertMissingSpacesAfterCommas(), InsertMissingSpacesAfterNo(), CRegexpUtil::ReplaceRange(), CFindASN1Dlg::ReplaceValue(), CMacroFunction_EditStringQual::s_EditText(), s_RegexpReplace(), and CMacroFunction_FixSpelling::s_SpellingFixes().
◆ ReplaceRange()Replace all occurrences of a substring within a string by pattern.
Use range specified by SetRange() method. Work like SED command s/.
Definition at line 450 of file regexp.cpp.
References CRegexpUtil::eInside, CTempString::empty(), CRegexpUtil::eOutside, CRegexp::fMatch_default, CRegexp::GetMatch(), i, CRegexpUtil::m_ContentList, CRegexpUtil::m_RangeEnd, CRegexpUtil::m_RangeStart, NON_CONST_ITERATE, CRegexp::NumFound(), CRegexpUtil::Replace(), and CRegexpUtil::x_Divide().
◆ Reset() ◆ Set()Set and compile PCRE.
Set and compile the PCRE pattern specified by argument according to compile options. Also deallocate/allocate memory for compiled PCRE.
Definition at line 138 of file regexp.cpp.
References ArraySize(), CTempString::data(), flags, CTempStringEx::HasZeroAtEnd(), CRegexp::m_MatchData, CRegexp::m_PReg, NCBI_THROW, NULL, pcre2_code, pcre2_code_free(), pcre2_compile(), pcre2_get_error_message(), pcre2_match_data, pcre2_match_data_create_from_pattern(), pcre2_match_data_free(), PCRE2_SPTR, PCRE2_UCHAR, s_GetRealCompileFlags(), and CTempString::size().
Referenced by CRegexp::CRegexp(), and CRemoveDescDlg::x_ApplyToSeq_entry().
◆ SetCommandStart() void CRegexpTemplateTester::SetCommandStart ( string & str ) ◆ SetCommentStart() void CRegexpTemplateTester::SetCommentStart ( string & str ) ◆ SetDelimiters() void CRegexpTemplateTester::SetDelimiters ( string & str ) ◆ SetRange()Set new range for range-dependent functions.
The matched string will be split up by "delimiter". And then in range-dependent functions every part (substring) is checked to fall into the range, specified by start and end addresses.
The addresses works similar to the Unix utility SED, except that regular expressions is Perl-compatible:
Specified range have effect only for range-dependent functions. Otherwise range is ignored.
Definition at line 337 of file regexp.cpp.
References delimiter, CRegexpUtil::m_Delimiter, CRegexpUtil::m_RangeEnd, CRegexpUtil::m_RangeStart, and CRegexpUtil::x_Divide().
Referenced by CRegexpUtil::ClearRange().
◆ SetVarScope() void CRegexpTemplateTester::SetVarScope ( string & start, string & end ) ◆ WildcardToRegexp() ◆ x_Compare()Main compare method, compare streams.
Can be used recursively to process includes. Return TRUE if 'stop' command found.
Definition at line 199 of file regexp_template_tester.cpp.
References CRegexpTemplateTester::eFile, ERROR_TEMPLATE, CRegexpTemplateTester::eStop, CRegexpTemplateTester::eTemplate, CRegexpTemplateTester::eTemplateEOF, len, CRegexpTemplateTester::m_CommentStart, CRegexpTemplateTester::m_FileLine, CRegexpTemplateTester::m_FileLineNum, CRegexpTemplateTester::m_OpStart, CRegexpTemplateTester::m_ReprocessFileLine, CRegexpTemplateTester::m_TemplateLine, NStr::StartsWith(), str(), NStr::TruncateSpaces_Unsafe(), CRegexpTemplateTester::x_CompareLines(), CRegexpTemplateTester::x_GetLine(), CRegexpTemplateTester::x_Op_Echo(), CRegexpTemplateTester::x_Op_Include(), CRegexpTemplateTester::x_Op_Set(), CRegexpTemplateTester::x_Op_Skip(), and CRegexpTemplateTester::x_Op_Test().
Referenced by CRegexpTemplateTester::Compare(), and CRegexpTemplateTester::x_Op_Include().
◆ x_CompareLines() ◆ x_Divide() [1/2] ◆ x_Divide() [2/2] void CRegexpUtil::x_Divide ( void ) inlineprivate ◆ x_GetLine() istream & CRegexpTemplateTester::x_GetLine ( istream & is, ESource src ) privateGet line from the stream 'is'.
Definition at line 263 of file regexp_template_tester.cpp.
References _TROUBLE, CRegexpTemplateTester::eFile, CRegexpTemplateTester::eTemplate, CRegexpTemplateTester::fSkipEmptySourceLines, CRegexpTemplateTester::fSkipEmptyTemplateLines, CRegexpTemplateTester::m_EOLs, CRegexpTemplateTester::m_FileLine, CRegexpTemplateTester::m_FileLineNum, CRegexpTemplateTester::m_Flags, CRegexpTemplateTester::m_TemplateLine, CRegexpTemplateTester::m_TemplateLineNum, NcbiGetline(), NULL, and str().
Referenced by CRegexpTemplateTester::Compare(), CRegexpTemplateTester::x_Compare(), and CRegexpTemplateTester::x_Op_Skip().
◆ x_Join() void CRegexpUtil::x_Join ( void ) private ◆ x_Match()Definition at line 219 of file regexp.cpp.
References f, flags, kRegexpMaxSubPatterns, CRegexp::m_JITStatus, CRegexp::m_MatchData, CRegexp::m_NumFound, CRegexp::m_PReg, CRegexp::m_Results, match_data, NULL, offset, pcre2_code, pcre2_get_ovector_pointer(), pcre2_jit_match(), pcre2_match(), pcre2_match_data, PCRE2_UCHAR, s_GetRealMatchFlags(), and str().
Referenced by CRegexp::GetMatch(), and CRegexp::IsMatch().
◆ x_Op_Echo() void CRegexpTemplateTester::x_Op_Echo ( CTempString str ) private ◆ x_Op_Include() void CRegexpTemplateTester::x_Op_Include ( CTempString str, istream & file_stm ) privateDefinition at line 541 of file regexp_template_tester.cpp.
References _ASSERT, CDirEntry::ConcatPath(), ERROR_TEMPLATE, i, len, CRegexpTemplateTester::m_TemplateLineNum, CRegexpTemplateTester::m_TemplateName, SKIP_SPACES, CDirEntry::SplitPath(), str(), and CRegexpTemplateTester::x_Compare().
Referenced by CRegexpTemplateTester::x_Compare().
◆ x_Op_Set() void CRegexpTemplateTester::x_Op_Set ( CTempString str ) privateDefinition at line 443 of file regexp_template_tester.cpp.
References _ASSERT, ERROR_TEMPLATE, i, len, CRegexpTemplateTester::m_Vars, n, NULL, SKIP_SPACES, str(), CRegexpTemplateTester::x_ParseVarName(), and CRegexpTemplateTester::x_SubstituteVars().
Referenced by CRegexpTemplateTester::x_Compare().
◆ x_Op_Skip() void CRegexpTemplateTester::x_Op_Skip ( CTempString str, istream & file_stm ) privateDefinition at line 577 of file regexp_template_tester.cpp.
References _ASSERT, CRegexpTemplateTester::eFile, CTempString::empty(), eNumber, ERROR_TEMPLATE, i, len, CRegexpTemplateTester::m_FileLine, CRegexpTemplateTester::m_ReprocessFileLine, NULL, NStr::NumericToString(), NStr::PrintableString(), AutoPtr< X, Del >::reset(), SKIP_SPACES, NStr::StartsWith(), str(), CTempString::substr(), CRegexpTemplateTester::x_GetLine(), and CRegexpTemplateTester::x_SubstituteVars().
Referenced by CRegexpTemplateTester::x_Compare().
◆ x_Op_Test() void CRegexpTemplateTester::x_Op_Test ( CTempString str ) privateDefinition at line 477 of file regexp_template_tester.cpp.
References _ASSERT, ncbi::grid::netcache::search::eEqual, eMatch, ERROR_TEMPLATE, NStr::Find(), i, CRegexp::IsMatch(), len, NPOS, NULL, NStr::PrintableString(), SKIP_SPACES, str(), and CRegexpTemplateTester::x_SubstituteVars().
Referenced by CRegexpTemplateTester::x_Compare().
◆ x_ParseVar() ◆ x_ParseVarName() ◆ x_Reset() void CRegexpTemplateTester::x_Reset ( void ) private ◆ x_SubstituteVars()Replace all variables in the string with corresponding values.
Also used for preparing inline variables for consecutive regexp matching.
Definition at line 365 of file regexp_template_tester.cpp.
References CTempString::empty(), ERROR_TEMPLATE, CTempString::find(), NStr::Find(), CRegexpTemplateTester::GetVar(), last(), CTempString::length(), CRegexpTemplateTester::m_VarEnd, CRegexpTemplateTester::m_VarStart, n, NPOS, NULL, out(), str(), CTempString::substr(), CRegexpTemplateTester::x_ParseVar(), and CRegexpTemplateTester::x_ParseVarName().
Referenced by CRegexpTemplateTester::x_CompareLines(), CRegexpTemplateTester::x_Op_Echo(), CRegexpTemplateTester::x_Op_Set(), CRegexpTemplateTester::x_Op_Skip(), and CRegexpTemplateTester::x_Op_Test().
◆ ~CRegexp() ◆ kRegexpMaxSubPatterns const size_t kRegexpMaxSubPatterns = 100 ◆ m_CommentStart string CRegexpTemplateTester::m_CommentStart private ◆ m_Content ◆ m_ContentList list<string> CRegexpUtil::m_ContentList private ◆ m_Delimiter ◆ m_EOLs string CRegexpTemplateTester::m_EOLs private ◆ m_FileLine string CRegexpTemplateTester::m_FileLine private ◆ m_FileLineNum SIZE_TYPE CRegexpTemplateTester::m_FileLineNum private ◆ m_FileName string CRegexpTemplateTester::m_FileName private ◆ m_Flags TFlags CRegexpTemplateTester::m_Flags private ◆ m_IsDivided bool CRegexpUtil::m_IsDivided private ◆ m_JITStatus ◆ m_MatchData void* CRegexp::m_MatchData private ◆ m_NumFound ◆ m_OpStart string CRegexpTemplateTester::m_OpStart private ◆ m_PReg ◆ m_RangeEnd ◆ m_RangeStart ◆ m_ReprocessFileLine bool CRegexpTemplateTester::m_ReprocessFileLine private ◆ m_Results ◆ m_TemplateLine string CRegexpTemplateTester::m_TemplateLine private ◆ m_TemplateLineNum SIZE_TYPE CRegexpTemplateTester::m_TemplateLineNum private ◆ m_TemplateName string CRegexpTemplateTester::m_TemplateName private ◆ m_VarEnd string CRegexpTemplateTester::m_VarEnd private ◆ m_Vars TVarMap CRegexpTemplateTester::m_Vars private ◆ m_VarStart string CRegexpTemplateTester::m_VarStart privateRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4