正则表达式匹配行的开始和行尾,以便快速查找和替换 [英] Regex to match start of line and end of line for quick find and replace

查看:237
本文介绍了正则表达式匹配行的开始和行尾,以便快速查找和替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计我已经有很多HTML要格式化

Hey guys I've got a whole lot of HTML to format with

myString + "<somehtml></somehtml>";

需要2个正则表达式,一个用 myString +替换所有新行
和一个用替换所有行的结尾;

Need 2 regex things, one to replace all new lines with myString + " and one to replace all end of lines with ";

只需使用MyEclipse,在启用正则表达式的情况下查找并替换。任何人都可以帮我吗?

Just using MyEclipse, Find and replace with regex enabled. Could anyone help me out?

推荐答案

单个正则表达式引擎可能会有所不同,但一般来说,'^'将匹配开头的一行和'$'将匹配一行的结尾。

Individual regular expression engines may vary, but generally speaking, '^' will match the beginning of a line and '$' will match the end of a line.

这篇关于正则表达式匹配行的开始和行尾,以便快速查找和替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆