本文翻译自:Notepad++ add to every line

I'm using Notepad++ and I can't figure this out : 我正在使用Notepad ++而我无法解决这个问题:

I have numerous lines all starting with http . 我有很多行都以http开头。 I need to add some text in front of it in every line. 我需要在每行中添加一些文本。 Also, I need to add different text to the end of each line. 另外,我需要在每行的末尾添加不同的文本。 Each line ends differently. 每条线的结尾都不同。

What is the fastest way to add text to the start and end of each line? 在每行的开头和结尾添加文本的最快方法是什么?


#1楼

参考:https://stackoom.com/question/kAa1/Notepad-添加到每一行


#2楼

Follow these steps: 跟着这些步骤:

  1. Press Ctrl + H to bring up the Find/Replace Dialog. 按Ctrl + H以显示“查找/替换”对话框。
  2. Choose the Regular expression option near the bottom of the dialog. 选择对话框底部附近的Regular expression选项。

To add a word, such as test , at the beginning of each line: 要在每行的开头添加一个单词,例如test

  1. Type ^ in the Find what textbox Find what文本框中键入^
  2. Type test in the Replace with textbox Replace with文本框中键入test
  3. Place cursor in the first line of the file to ensure all lines are affected 将光标放在文件的第一行以确保所有行都受到影响
  4. Click Replace All button 单击Replace All按钮

To add a word, such as test , at the end of each line: 要在每行的末尾添加一个单词,例如test

  1. Type $ in the Find what textbox Find what文本框中键入$
  2. Type test in the Replace with textbox Replace with文本框中键入test
  3. Place cursor in the first line of the file to ensure all lines are affected 将光标放在文件的第一行以确保所有行都受到影响
  4. Click Replace All button 单击Replace All按钮

#3楼

Notepad++ has a very powerful editing capability. Notepad ++具有非常强大的编辑功能。 (Today I'm searching for the similar function in Sublime Text), but for Notepad++, just hold Alt when you drag the mouse. (今天我在Sublime Text中搜索类似的功能),但对于Notepad ++,只需在拖动鼠标时按住Alt键 。 What you type will then replace the selected column on every line. 然后,您键入的内容将替换每行上的选定列。 To insert without replacing existing text, use Alt-Shift . 要在不替换现有文本的情况下插入,请使用Alt-Shift 。


#4楼

  1. Move your cursor to the start of the first line 将光标移动到第一行的开头
  2. Hold down Alt + Shift and use the cursor down key to extend the selection to the end of the block 按住Alt + Shift并使用向下光标键将选择范围扩展到块的末尾

This allows you to type on every line simultaneously. 这允许您同时键入每一行。

I found the solution above here . 我在这里找到了解决方案。

I think this is much easier than using regex. 我认为这比使用正则表达式容易得多。


#5楼

Open Notepad++, then click Ctrl + F . 打开Notepad ++,然后单击Ctrl + F.

Choose Regular Expression 选择正则表达式

*Find What: "^" (which represents index of the each line - "PREFIX"). *查找内容:“^”(表示每行的索引 - “PREFIX”)。

Replace with : "anyText"* 替换为:“anyText”*

For Suffix on each line: Follow the same steps as above "Replace ^ with $" . 对于每行的后缀 :按照上面“使用$替换^”中的相同步骤操作。 That's it. 而已。


#6楼

You can automatically do it in Notepad++ (add text at the beginning and/or end of each line) by using one regular expression in Replace ( Ctrl + H ): 您可以在Notepad ++中自动执行此操作 (在每行的开头和/或末尾添加文本) ,使用 Replace( Ctrl + H )中的一个正则表达式

Explanation: Expression $1 in Replace with input denotes all the characters that include the round brackets (.*) in Find what regular expressin. 说明: 替换为输入中的表达式$1表示在查找常规表达式中包含圆括号(.*)所有字符。

Tested, it works. 经测试,它的工作原理。

Hope that helps. 希望有所帮助。

Notepad ++添加到每一行相关推荐

  1. 监视窗口添加 $err,hr 一行来实时现实错误

    在Visual C++ 中,可以在监视窗口添加 $err,hr 一行来实时现实错误.调试过程中,该项相当于在每次调用API函数之后调用GetLastError函数.其值由两部分组成,一个是错误代码(十 ...

  2. PHP实现单击“添加”按钮增加一行表单项,并将所有内容插入到数据库中

    PHP实现单击"添加"按钮增加一行表单项,并将所有内容插入到数据库中 效果图: html+jquery: <html> <head> <meta ht ...

  3. 如何创建一个Python Pandas的DataFrame变量,如何给一个DataFrame对象添加新的一行数据?

    如何给一个Python Pandas的DataFrame对象添加新一行数据? 1.如何创建一个新的dataframe变量. 1) 创建一个没有列名的dataframe变量:df = pd.DataFr ...

  4. NotePad++添加到右键快捷方式

    首先看效果图: NotePad++添加到右键快捷方式 接下来是操作方式: 首先在桌面上新建一个txt文本文档,然后将写入如下内容 Windows Registry Editor Version 5.0 ...

  5. Notepad++添加右键打开方式

    安装免安装版本的Notepad++,虽然省了安装的事,但是打开文件的时候很麻烦,每次都靠拖动文件到notepad++上,很恶心~ 其实想把notepad++添加到右键打开方式上,需要添加注册表: 如下 ...

  6. Notepad++ 添加右键菜单

    Notepad++ 添加右键菜单 Notepad++ 绿色版 右键菜单没有它,每次都要查找 notepad++.exe 来打开没关联的文件. 根据网上的一些方法,准备一个notepad.reg,导入注 ...

  7. notepad++使用技巧第7篇---将notepad++添加到打开方式列表中的解决办法

    将notepad++添加到打开方式列表中的解决办法 出现原因 解决方法 当然方法也适用于其他软件 出现原因 之前删除没有删除注册表信息,而又与新安装路径不同导致无法出现在打开方式,以至于在路径下选择也 ...

  8. 【转】无法将notepad++添加到打开方式列表中的解决办法

    问题:想要设置notepad++为默认打开方式,却发现在点击browse找到notepad++.exe点击打开后没有在打开方式列表中找到notepad++.  原因:更新程序版本后程序的路径发生了变动 ...

  9. 20100506 学习记录:grdview添加新的一行数据

    目标: 每选择一个新的offercode,点按钮 把新记录添加进当前的grdview,并要记住之前添加的记录 思路: 从 offercode 取得该条记录信息 点击按钮添加时,给datatable创建 ...

最新文章

  1. 【任务脚本】0523更新京东618叠蛋糕任务脚本全自动脚本,大神更新了京东任务全自动程序...
  2. 算法竞赛入门经典(第二版) | 例题4-5 追踪电子表格中的单元格 (UVa512,Spreadsheet Tracking,World Finals)(解法一)
  3. 莫比乌斯反演部分题目总结
  4. docker nginx1.7.6+keepalived实现双机热备
  5. 《计算机网络思想》系列(1)网络体系结构———理解,总结,辨析,升华
  6. java 给对象添加属性_在java中怎么给对象添加属性和方法?实例分享
  7. 金笛JDMAIL邮件系统办公管理—文件中转站
  8. Yasm入门-hello world
  9. b 站视频下载神器合集,支持电脑和手机端
  10. excel宏编程 c语言,宏(巨集)
  11. android云新消息接收者全局,消息推送之百度云推送Android集成与用法(示例代码)...
  12. Final Cut Pro X无法导入自家的MOV格式,解决方法。
  13. ContextCaptureMaster/Smart3D集群设置经验分享
  14. MasterCAM快捷功能大全
  15. 详解马氏距离中的协方差矩阵计算(超详细)
  16. 一篇联想员工写的:联想不是我的家
  17. 杜静20176395
  18. gnuplot画图点线设置
  19. 离线下载安装Microsoft Store中的应用
  20. 虚拟机mac 与主机的网络共享

热门文章

  1. SQL Server 2008及以上版本出现”SQL Server 复制需要有实际的服务器名称才能连接到服务器...“的问题解决...
  2. 应用内截屏的代码,在Activity中测试可用
  3. 思想一碰就冒火: 开源贡献须耐心, 选择框架要谨慎
  4. RMBP下eclipse支持高清
  5. 如何想要在开机启动登陆时,用户名也不输入
  6. 安装虚拟机工具 linux虚拟机访问windows文件夹
  7. Basic Edit in vim
  8. 生成模型和判别模型直接的区别
  9. 使用泛型, 写一个为任意类型的动态数组添加元素的方法
  10. (HDOJ 2034)人见人爱A-B