A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/group__Regexp.html below:

NCBI C++ ToolKit: Regular Expressions

enum   CRegexp::ECompile {
  CRegexp::fCompile_default = 0x80000000 , CRegexp::fCompile_ignore_case = 0x80000001 , CRegexp::fCompile_dotall = 0x80000002 , CRegexp::fCompile_newline = 0x80000004 ,
  CRegexp::fCompile_ungreedy = 0x80000008 , CRegexp::fCompile_extended = 0x80000010
}   Flags for compile regular expressions. More...
  enum   CRegexp::ECompile_deprecated {
  CRegexp::eCompile_default = fCompile_default , CRegexp::eCompile_ignore_case = fCompile_ignore_case , CRegexp::eCompile_dotall = fCompile_dotall , CRegexp::eCompile_newline = fCompile_newline ,
  CRegexp::eCompile_ungreedy = fCompile_ungreedy
}   enum   CRegexp::EMatch { CRegexp::fMatch_default = 0x80000000 , CRegexp::fMatch_not_begin = 0x80000001 , CRegexp::fMatch_not_end = 0x80000002 , CRegexp::fMatch_not_both = fMatch_not_begin | fMatch_not_end }   Flags for match string against a precompiled pattern. More...
  enum   CRegexp::EMatch_deprecated { CRegexp::eMatch_default = fMatch_default , CRegexp::eMatch_not_begin = fMatch_not_begin , CRegexp::eMatch_not_end = fMatch_not_end , CRegexp::eMatch_not_both = fMatch_not_both }   enum   CRegexpUtil::ERange { CRegexpUtil::eInside , CRegexpUtil::eOutside }   Range processing type. More...
  enum   CRegexpException::EErrCode { CRegexpException::eCompile , CRegexpException::eBadFlags }   enum   CRegexpTemplateTester::EFlags { CRegexpTemplateTester::fSkipEmptySourceLines = (1 << 0) , CRegexpTemplateTester::fSkipEmptyTemplateLines = (1 << 1) , CRegexpTemplateTester::fSkipEmptyLines = fSkipEmptySourceLines | fSkipEmptyTemplateLines }   enum   CRegexpTemplateTester::ESource { CRegexpTemplateTester::eFile , CRegexpTemplateTester::eTemplate }   Processing source. More...
  enum   CRegexpTemplateTester::EResult { CRegexpTemplateTester::eTemplateEOF , CRegexpTemplateTester::eStop }   The reason of stopping x_Compare(), if no error. More...
  enum   CRegexpTemplateTesterException::EErrCode {
  CRegexpTemplateTesterException::eOpenFile , CRegexpTemplateTesterException::eMismatchLength , CRegexpTemplateTesterException::eMismatchContent , CRegexpTemplateTesterException::eVarNotFound ,
  CRegexpTemplateTesterException::eVarErr , CRegexpTemplateTesterException::eOpUnknown , CRegexpTemplateTesterException::eOpErr , CRegexpTemplateTesterException::eOpTest
}   Error types that tester can generate. More...
  string  ConvertDateTo_iso8601 (string const &value)   Convert dates from an arbitrary format to corresponding ISO 8601. More...
  pair< string, stringConvertDateTo_iso8601_and_annotate (string const &value)   Convert dates from an arbitrary format to corresponding ISO 8601, with annotation. More...
    CRegexp::CRegexp (CTempStringEx pattern, TCompile flags=fCompile_default)   Constructor. More...
  virtual  CRegexp::~CRegexp ()   Destructor. More...
  void  CRegexp::Set (CTempStringEx pattern, TCompile flags=fCompile_default)   Set and compile PCRE. More...
  CTempString  CRegexp::GetMatch (CTempString str, size_t offset=0, size_t idx=0, TMatch flags=fMatch_default, bool noreturn=false)   Get matching pattern and subpatterns. More...
  bool  CRegexp::IsMatch (CTempString str, TMatch flags=fMatch_default)   Check existence substring which match a specified pattern. More...
  CTempString  CRegexp::GetSub (CTempString str, size_t idx=0) const   Get pattern/subpattern from previous GetMatch(). More...
  void  CRegexp::GetSub (CTempString str, size_t idx, string &dst) const   Get pattern/subpattern from previous GetMatch(). More...
  int  CRegexp::NumFound () const   Get number of patterns + subpatterns. More...
  const TOffsetCRegexp::GetResults (size_t idx) const   Get location of pattern/subpattern for the last GetMatch(). More...
  static string  CRegexp::Escape (CTempString str)   Escape all regular expression meta characters in the string. More...
  static string  CRegexp::WildcardToRegexp (CTempString mask)   Convert wildcard mask to regular expression. More...
    CRegexp::CRegexp (const CRegexp &)   void  CRegexp::operator= (const CRegexp &)   void  CRegexp::x_Match (CTempString str, size_t offset, TMatch flags)     CRegexpUtil::CRegexpUtil (CTempString str=kEmptyStr)   Constructor. More...
  void  CRegexpUtil::Reset (CTempString str)   Reset the content of the string to process. More...
  void  CRegexpUtil::operator= (CTempString str)   Reset the content of the string to process. More...
  string  CRegexpUtil::GetResult (void)   Get result string. More...
    CRegexpUtil::operator string (void)   Get result string. More...
  bool  CRegexpUtil::Exists (CTempStringEx pattern, CRegexp::TCompile compile_flags=CRegexp::fCompile_default, CRegexp::TMatch match_flags=CRegexp::fMatch_default)   Check existence of substring which match a specified pattern. More...
  string  CRegexpUtil::Extract (CTempStringEx pattern, CRegexp::TCompile compile_flags=CRegexp::fCompile_default, CRegexp::TMatch match_flags=CRegexp::fMatch_default, size_t pattern_idx=0)   Get matching pattern/subpattern from string. More...
  size_t  CRegexpUtil::Replace (CTempStringEx search, CTempString replace, CRegexp::TCompile compile_flags=CRegexp::fCompile_default, CRegexp::TMatch match_flags=CRegexp::fMatch_default, size_t max_replace=0)   Replace occurrences of a substring within a string by pattern. More...
  void  CRegexpUtil::SetRange (CTempStringEx addr_start=kEmptyStr, CTempStringEx addr_end=kEmptyStr, CTempString delimiter="\n")   Set new range for range-dependent functions. More...
  void  CRegexpUtil::ClearRange (void)   Clear range for range-dependent functions. More...
  size_t  CRegexpUtil::ReplaceRange (CTempStringEx search, CTempString replace, CRegexp::TCompile compile_flags=CRegexp::fCompile_default, CRegexp::TMatch match_flags=CRegexp::fMatch_default, CRegexpUtil::ERange process_within=eInside, size_t max_replace=0)   Replace all occurrences of a substring within a string by pattern. More...
  void  CRegexpUtil::x_Divide (CTempString delimiter)   Divide source string to substrings by delimiter for separate processing. More...
  void  CRegexpUtil::x_Divide (void)   void  CRegexpUtil::x_Join (void)   Join substrings back to entire string. More...
  virtual const char *  CRegexpException::GetErrCodeString (void) const override   Get error code interpreted as text. More...
    CRegexpException::NCBI_EXCEPTION_DEFAULT (CRegexpException, CException)     CRegexpTemplateTester::CRegexpTemplateTester (TFlags flags=0)   Default constructor. More...
  void  CRegexpTemplateTester::Compare (const string &file_path, const string &template_path)   Compare file against template (file version). More...
  void  CRegexpTemplateTester::Compare (istream &file_stream, istream &template_stream)   Compare file against template (stream version). More...
  void  CRegexpTemplateTester::SetVarScope (string &start, string &end)   Change strings defining start/end of variables. More...
  void  CRegexpTemplateTester::SetCommentStart (string &str)   Change string defining start of comments line in templates. More...
  void  CRegexpTemplateTester::SetCommandStart (string &str)   Change string defining start of template commands and operations. More...
  void  CRegexpTemplateTester::SetDelimiters (string &str)   Change delimiters string, used for comparing data and templates. More...
  void  CRegexpTemplateTester::PrintVars (void) const   void  CRegexpTemplateTester::PrintVar (const string &name) const   string  CRegexpTemplateTester::GetVar (const string &name) const   const TVarMapCRegexpTemplateTester::GetVars (void) const   void  CRegexpTemplateTester::x_Op_Set (CTempString str)   void  CRegexpTemplateTester::x_Op_Echo (CTempString str)   void  CRegexpTemplateTester::x_Op_Test (CTempString str)   void  CRegexpTemplateTester::x_Op_Include (CTempString str, istream &file_stm)   void  CRegexpTemplateTester::x_Op_Skip (CTempString str, istream &file_stm)   void  CRegexpTemplateTester::x_Reset (void)   Reset object state. More...
  EResult  CRegexpTemplateTester::x_Compare (istream &file_stream, istream &template_stream)   Main compare method, compare streams. More...
  void  CRegexpTemplateTester::x_CompareLines (CTempString file_line, CTempString template_line)   Process/compare lines. More...
  SIZE_TYPE  CRegexpTemplateTester::x_ParseVar (CTempString str, SIZE_TYPE pos) const   Parse variable from string, return its length. More...
  SIZE_TYPE  CRegexpTemplateTester::x_ParseVarName (CTempString str, SIZE_TYPE pos) const   Parse/check variable name from string, return its length. More...
  string  CRegexpTemplateTester::x_SubstituteVars (CTempString str, TVarList *inline_vars) const   Replace all variables in the string with corresponding values. More...
  istream &  CRegexpTemplateTester::x_GetLine (istream &is, ESource src)   Get line from the stream 'is'. More...
  virtual const char *  CRegexpTemplateTesterException::GetErrCodeString (void) const override   CRegexpTemplateTesterException –. More...
    CRegexpTemplateTesterException::NCBI_EXCEPTION_DEFAULT (CRegexpTemplateTesterException, CCoreException)   ◆ TCompile

Type definitions used for code clarity.

Compilation options.

Definition at line 84 of file regexp.hpp.

◆ TFlags ◆ TMatch ◆ TOffset ◆ TVarList ◆ TVarMap ◆ ECompile

Flags 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_extended 

Definition at line 109 of file regexp.hpp.

◆ ECompile_deprecated Enumerator eCompile_default  eCompile_ignore_case  eCompile_dotall  eCompile_newline  eCompile_ungreedy 

Definition at line 118 of file regexp.hpp.

◆ EErrCode [1/2] Enumerator eCompile  eBadFlags 

Definition at line 555 of file regexp.hpp.

◆ EErrCode [2/2]

Error types that tester can generate.

Enumerator eOpenFile 

file open error

eMismatchLength 

file/template line number mismatch

eMismatchContent 

file/template lines do not match

eVarNotFound 

variable not found

eVarErr 

variable definition error

eOpUnknown 

unknown operation

eOpErr 

operation definition error

eOpTest 

'test' operation return FALSE

Definition at line 357 of file regexp_template_tester.hpp.

◆ EFlags Enumerator fSkipEmptySourceLines 

Skip empty lines in the source.

fSkipEmptyTemplateLines 

Skip empty lines in the template.

fSkipEmptyLines 

Definition at line 204 of file regexp_template_tester.hpp.

◆ EMatch

Flags 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_both 

Definition at line 134 of file regexp.hpp.

◆ EMatch_deprecated Enumerator eMatch_default  eMatch_not_begin  eMatch_not_end  eMatch_not_both 

Definition at line 141 of file regexp.hpp.

◆ ERange

Range processing type.

Defines which part of the specified range should be processed.

Enumerator eInside 

Process substrings inside range.

eOutside 

Process 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.

Parameters
pattern Perl regular expression to compile. flags Regular expression compilation flags.
See also
ECompile

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.

Parameters
str String to search. offset Starting offset in str. idx (Sub) match to return. Use idx = 0 for complete pattern. Use idx > 0 for subpatterns. flags Flags to match. noreturn Return empty string if noreturn is true.
Returns
Return (sub) match with number idx or empty string when no match found or if noreturn is true.
See also
EMatch, GetSub, GetResult

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  ) inline

Get result string.

See also
operator 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().

Parameters
idx Index of pattern/subpattern to obtaining. Use idx = 0 for pattern, idx > 0 for sub patterns.
Returns
Return array where index 0 is location of first character in pattern/sub pattern and index 1 is 1 beyond last character in pattern/sub pattern. Throws if called with idx >= NumFound().
See also
GetMatch(), NumFound()

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.

Parameters
str String to search. idx (Sub) match to return.
Returns
Return the substring at location of pattern match (idx 0) or subpattern match (idx > 0). Return empty string when no match.
See also
GetMatch(), GetResult()

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().

Parameters
str String to search. flags Flags to match.
Returns
Return TRUE if a string corresponding to the match to pattern.
See also
EMatch, GetMatch, NumFound

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 inline

Get number of patterns + subpatterns.

Returns
Return the number of patterns + subpatterns found as a result of the most recent GetMatch() call (check on >= 0).
See also
GetMatch, IsMatch

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 stringname ) const ◆ PrintVars() void CRegexpTemplateTester::PrintVars ( void  ) const ◆ Replace()

Replace occurrences of a substring within a string by pattern.

Parameters
search Regular expression to match a substring value that is replaced. replace Replace "search" substring with this value. The matched subpatterns (if any) can be found and inserted into replace string using variables $1, $2, $3, and so forth. The variable can be enclosed in the curly brackets {}, that will be deleted on substitution. compile_flags Regular expression compilation flags. match_flags Flags to match. max_replace Replace no more than "max_replace" occurrences of substring "search". If "max_replace" is zero (default), then replace all occurrences with "replace".
Returns
Return the count of replacements.
See also
CRegexp, ReplaceRange()

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/.

Parameters
search Regular expression to match a substring value that is replaced. replace Replace "search" substring with this value. The matched subpatterns (if any) can be found and inserted into replace string using variables $1, $2, $3, and so forth. The variable can be enclosed in the curly brackets {}, that will be deleted on substitution. compile_flags Regular expression compilation flags. match_flags Flags to match. process_within Define which part of the range should be processed. max_replace Replace no more than "max_replace" occurrences of substring "search" in the every substring. If "max_replace" is zero (default), then replace all occurrences with "replace".
Returns
Return the count of replacements.
See also
ERange, SetRange(), ClearRange()

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.

Parameters
pattern Perl regular expression to compile. flags Regular expression compilation flags.
See also
ECompile

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 ( stringstr ) ◆ SetCommentStart() void CRegexpTemplateTester::SetCommentStart ( stringstr ) ◆ SetDelimiters() void CRegexpTemplateTester::SetDelimiters ( stringstr ) ◆ 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.

Parameters
addr_start Regular expression which assign a starting address of range. addr_end Regular expression which assign an ending address of range. Should be empty if the start address is empty. delimiter Split a source string by "delimiter.
See also
ClearRange, ReplaceRange()

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 ( stringstart, stringend  ) ◆ 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  ) private

Get 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  ) private

Definition 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 ) private

Definition 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  ) private

Definition 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 ) private

Definition 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 private

RetroSearch 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