ure.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. """
  2. ure 模块用于测试字符串的某个模式,执行正则表达式操作。
  3. """
  4. DEBUG = ... # type: int
  5. class compile(...):
  6. """
  7. - compile(regex_str[, flags])
  8. 编译正则表达式,返回 regex 对象。
  9. """
  10. ...
  11. def __init__(self) -> None:
  12. ...
  13. def match(string) -> None:
  14. """用 string 匹配 regex,匹配总是从字符串的开始匹配。"""
  15. ...
  16. def search(string) -> None:
  17. """在 string 中搜索 regex。不同于匹配,它搜索第一个匹配位置的正则表达式字符串 (结果可能会是0)。"""
  18. ...
  19. def sub(replace, string, count, flags) -> None:
  20. """Compile regex_str and search for it in string, replacing all matches with replace, and returning the new string."""
  21. ...
  22. def split() -> None:
  23. """获取缓存区内容。"""
  24. ...
  25. class match(...):
  26. """
  27. - Match objects as returned by match() and search() methods。
  28. """
  29. ...
  30. def __init__(self) -> None:
  31. ...
  32. def group(index) -> None:
  33. """用 string 匹配 regex,匹配总是从字符串的开始匹配。"""
  34. ...
  35. def groups() -> None:
  36. """在 string 中搜索 regex。不同于匹配,它搜索第一个匹配位置的正则表达式字符串 (结果可能会是0)。"""
  37. ...
  38. def start(index) -> None:
  39. """start([index])"""
  40. ...
  41. def end(index) -> None:
  42. """end([index])
  43. Return the index in the original string of the start or end of the substring group that was matched. index defaults to the entire group, otherwise it will select a group.
  44. """
  45. ...
  46. def span() -> None:
  47. """Returns the 2-tuple (match.start(index), match.end(index))."""
  48. ...
  49. class search(...):
  50. """
  51. - Match objects as returned by match() and search() methods。
  52. """
  53. ...
  54. def __init__(self) -> None:
  55. ...
  56. def group(index) -> None:
  57. """用 string 匹配 regex,匹配总是从字符串的开始匹配。"""
  58. ...
  59. def groups() -> None:
  60. """在 string 中搜索 regex。不同于匹配,它搜索第一个匹配位置的正则表达式字符串 (结果可能会是0)。"""
  61. ...
  62. def start(index) -> None:
  63. """start([index])"""
  64. ...
  65. def end(index) -> None:
  66. """end([index])
  67. Return the index in the original string of the start or end of the substring group that was matched. index defaults to the entire group, otherwise it will select a group.
  68. """
  69. ...
  70. def span() -> None:
  71. """Returns the 2-tuple (match.start(index), match.end(index))."""
  72. ...
  73. def match(regex, string) -> None:
  74. """用 string 匹配 regex,匹配总是从字符串的开始匹配。"""
  75. ...
  76. def search(regex, string) -> None:
  77. """在 string 中搜索 regex。不同于匹配,它搜索第一个匹配位置的正则表达式字符串 (结果可能会是0)。"""
  78. ...
  79. def sub(regex_str, replace, string, count, flags) -> None:
  80. """Compile regex_str and search for it in string, replacing all matches with replace, and returning the new string."""
  81. ...