【发布时间】:2016-11-25 23:43:49
【问题描述】:
为什么这个(?=^\s*)print_debug 正向预测与\s* 空格不匹配?
完整的正则表达式模式是(?=^\s*)print_debug。样本匹配为:
print_debug('scroll set: '+str(position));
print_debug('scroll set: '+str(position));
print_debug('scroll set: '+str(position));
print_debug('supposed current scroll: '+str(view.viewport_position())); # THIS LIES
else:
print_debug('SKIPPED...')
但它只匹配前两行:
这是一个在线正则表达式引擎的链接:
为什么\s* 与^ 一起使用时会被忽略?
- 如果删除
^,\s*开始匹配。 - 如果添加
^,\s*将停止工作。
我希望它在Sublime Text 上使用并禁用我的Python Sublime Text 包源代码文件中的所有调试语句。
【问题讨论】:
标签: python regex sublimetext3 lookahead negative-lookahead