• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ basic_regex类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中basic_regex的典型用法代码示例。如果您正苦于以下问题:C++ basic_regex类的具体用法?C++ basic_regex怎么用?C++ basic_regex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了basic_regex类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: regex_split

std::size_t regex_split(OutputIterator out,
                   std::basic_string<charT, Traits1, Alloc1>& s, 
                   const basic_regex<charT, Traits2>& e,
                   match_flag_type flags,
                   std::size_t max_split)
{
   typedef typename std::basic_string<charT, Traits1, Alloc1>::const_iterator  ci_t;
   //typedef typename match_results<ci_t>::allocator_type                        match_allocator;
   ci_t last = s.begin();
   std::size_t init_size = max_split;
   re_detail::split_pred<OutputIterator, charT, Traits1, Alloc1> pred(&last, &out, &max_split);
   ci_t i, j;
   i = s.begin();
   j = s.end();
   regex_grep(pred, i, j, e, flags);
   //
   // if there is still input left, do a final push as long as max_split
   // is not exhausted, and we're not splitting sub-expressions rather 
   // than whitespace:
   if(max_split && (last != s.end()) && (e.mark_count() == 0))
   {
      *out = std::basic_string<charT, Traits1, Alloc1>((ci_t)last, (ci_t)s.end());
      ++out;
      last = s.end();
      --max_split;
   }
   //
   // delete from the string everything that has been processed so far:
   s.erase(0, last - s.begin());
   //
   // return the number of new records pushed:
   return init_size - max_split;
}
开发者ID:13W,项目名称:icq-desktop,代码行数:33,代码来源:regex_split.hpp


示例2: perl_matcher

 perl_matcher(BidiIterator first, BidiIterator end, 
    match_results<BidiIterator, Allocator>& what, 
    const basic_regex<char_type, traits>& e,
    match_flag_type f,
    BidiIterator l_base)
    :  m_result(what), base(first), last(end), 
       position(first), backstop(l_base), re(e), traits_inst(e.get_traits()), 
       m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
 {
    construct_init(e, f);
 }
开发者ID:3309622938,项目名称:soundcloud-win-sharing,代码行数:11,代码来源:perl_matcher.hpp


示例3: regex_search

bool regex_search(BidiIterator first, BidiIterator last, 
                  match_results<BidiIterator, Allocator>& m, 
                  const basic_regex<charT, traits>& e, 
                  match_flag_type flags,
                  BidiIterator base)
{
   if(e.flags() & regex_constants::failbit)
      return false;

   BOOST_REGEX_DETAIL_NS::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, base);
   return matcher.find();
}
开发者ID:1234-,项目名称:passenger,代码行数:12,代码来源:regex_search.hpp


示例4:

 /// \param begin The beginning of the character range to search.
 /// \param end The end of the character range to search.
 /// \param rex The regex pattern to search for.
 /// \pre \c [begin,end) is a valid range.
 regex_token_iterator
 (
     BidiIter begin
   , BidiIter end
   , basic_regex<BidiIter> const &rex
 )
   : impl_()
 {
     if(0 != rex.regex_id())
     {
         this->impl_ = new impl_type_(begin, begin, end, begin, rex);
         this->next_();
     }
 }
开发者ID:13W,项目名称:icq-desktop,代码行数:18,代码来源:regex_token_iterator.hpp


示例5: regex_grep

inline unsigned int regex_grep(Predicate foo, 
                               BidiIterator first, 
                               BidiIterator last, 
                               const basic_regex<charT, traits>& e, 
                               match_flag_type flags = match_default)
{
   if(e.flags() & regex_constants::failbit)
      return false;

   typedef typename match_results<BidiIterator>::allocator_type match_allocator_type;

   match_results<BidiIterator> m;
   re_detail::perl_matcher<BidiIterator, match_allocator_type, traits> matcher(first, last, m, e, flags, first);
   unsigned int count = 0;
   while(matcher.find())
   {
      ++count;
      if(0 == foo(m))
         return count; // caller doesn't want to go on
      if(m[0].second == last)
         return count; // we've reached the end, don't try and find an extra null match.
      if(m.length() == 0)
      {
         if(m[0].second == last)
            return count;
         // we found a NULL-match, now try to find
         // a non-NULL one at the same position:
         match_results<BidiIterator, match_allocator_type> m2(m);
         matcher.setf(match_not_null | match_continuous);
         if(matcher.find())
         {
            ++count;
            if(0 == foo(m))
               return count;
         }
         else
         {
            // reset match back to where it was:
            m = m2;
         }
         matcher.unsetf((match_not_null | match_continuous) & ~flags);
      }
   }
   return count;
}
开发者ID:AsherBond,项目名称:PDAL,代码行数:45,代码来源:regex_grep.hpp


示例6: match

 static bool match(basic_regex<BidiIter> const &rex, match_state<BidiIter> &state)
 {
     return rex.match_(state);
 }
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:4,代码来源:access.hpp


示例7: invalid

 static bool invalid(basic_regex<BidiIter> const &rex)
 {
     return rex.invalid_();
 }
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:4,代码来源:access.hpp



注:本文中的basic_regex类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ basic_socket类代码示例发布时间:2022-05-31
下一篇:
C++ basic_json类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap