modified_cpplint.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:linter 作者: ethz-asl 项目源码 文件源码
def ReplaceAll(pattern, rep, s):
  """Replaces instances of pattern in a string with a replacement.

  The compiled regex is kept in a cache shared by Match and Search.

  Args:
    pattern: regex pattern
    rep: replacement text
    s: search string

  Returns:
    string with replacements made (or original string if no replacements)
  """
  if pattern not in _regexp_compile_cache:
    _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
  return _regexp_compile_cache[pattern].sub(rep, s)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号