一定数量字符的正则表达式
我正在尝试使用 TextWrangler 更改大量 URL,那些以 m.htm
结尾的 URL 应该会丢失 m
,但前提是文件名中的字符总数为7. 字符数较少的不要更改。
我已经尝试过
/.*?{7}m.htm/
,但不起作用...
解决方案是什么?
I'm trying to change a lot of URLs with TextWrangler, those ending with m.htm
should lose the m
, but only if the total number of characters in the filename is 7. Those with fewer characters should not be changed.
I've tried
/.*?{7}m.htm/
but it doesn't work...
What is the solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
替换
含义:
href="
后跟任何非"
字符,直到/
(越晚越好:贪婪),然后是 6 个字符,后跟一个m
,然后是任何非"
字符。含义
:
示例
如果文件可以是
htm
和php
,我建议将.htm
替换为(.htm|.php)
(!警告反向引用数字更改!)Replace
Meaning :
href="
followed by any non"
character until a/
(the latest the better: greedy) then 6 character followed by am
, then any non"
character.By
Meaning :
Example
If files can be
htm
andphp
, I suggest to replace.htm
by(.htm|.php)
(!Warning to back-references change in numbers!)可能是
即从单词边界开始,后跟任意 6 个符号,最后是 m.htm。
May be
That is, starting on the word boundary, followed by any 6 symbols, followed by m.htm.