• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
新能源汽车行业用户产品设计
新能源汽车行业、面向C端用户的产品设计
博客园    首页    新随笔       管理     

EditPlus中的正则表达式中英文详解(附常用实例)

EditPlus正则表达式中英文详解

  • \t Tab character.tab符号
  • \n New line.新的一行(换行符)
  • . Matches any character.任何字符
  • | Either expression on its left and right side matches the target string.For example, “a|b” matches “a” and “b”.|符号两边的都匹配
  • [] Any of the enclosed characters may match the target character.For example, “[ab]” matches “a” and “b”. “[0-9]” matches any digit.用[]括起来的都匹配
  • [^] None of the enclosed characters may match the target character.For example, “[^ab]” matches all character EXCEPT “a” and “b”.“[^0-9]” matches any non-digit character.用[]括起来的都“不匹配”
  • * Character to the left of asterisk in the expression should match 0 or more times.For example “be*” matches “b”, “be” and “bee”.“*”号左边的那个字符匹配0次或者更多次
  • + Character to the left of plus sign in the expression should match 1 or more times.For example “be+” matches “be” and “bee” but not “b”.“*”号左边的那个字符匹配1次或者更多次
  • ? Character to the left of question mark in the expression should match 0 or 1 time.For example “be?” matches “b” and “be” but not “bee”.“*”号左边的那个字符匹配0次或者1次
  • ^ Expression to the right of ^ matches only when it is at the beginning of line.For example “^A” matches an “A” that is only at the beginning of line.只匹配以“^”号右边的字符为一行开头的字符。
  • $ Expression to the left of $ matches only when it is at the end of line.For example “e$” matches an “e” that is only at the end of line.只匹配以“$”号左边的字符为一行结束的字符。
  • () Affects evaluation order of expression and also used for tagged expression.标示表达式区域
  • \ scape character. If you want to use character “\” itself, you should use “\\”.转义字符,如果你想匹配"\"。请使用"\\"
  • \0你使用正则表达式找到的东西

常用EditPlus正则表达式实例

把img标签的alt去掉
搜索内容:alt="[^src| ]* 注:"|"符号后有个空格
替换内容:alt=""
把带属性和样式的<font>标签去掉
第一步:把</font>去掉。
搜索内容:</font>
替换内容:不填

第二步:去掉带属性和样式的<font>标签
搜索内容:<font [^>]*>
替换内容:不填
去掉所有的空行
搜索内容:\n\n
替换内容:\n

相关文章列表

  • 使用EditPlus技巧,提高工作效率(附英文版、自动完成文件、语法文件下载)
  • “阿一web标准学堂”选修课:EditPlus高级使用技巧(附视频、课件、代码下载)
  • EditPlus 快捷键
posted @ 2008-06-05 16:33  阿一(杨正祎)  阅读(2447)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3