简体   繁体   中英

Regex search & replace in Sublime Text 2

I have an XML Wordpress file that contains this (actually many of these, each with multiple paragraphs/line breaks):

<content:encoded><![CDATA[We read a lot of <strong>stuff</strong> these days. We're bombarded with emails, text messages, blogs, snail mail, junk mail, recipes, pollen counts, newspapers, CNN tickers, Facebook statuses, Tweets and more.

But do we take the time to read <em>important</em> documents when they pass through our hands? Sometimes.]]></content:encoded>

I need a regex that will only search within the <content:encoded></content:encoded> tags and replace the double line breaks with <br><br> , using Sublime Text 2 search & replace. Help?

I tried this with the provided line copied twice in Sublime Text 2 and it seems to be working:

Search for: (<content:encoded>.*)\\n*(.*</content:encoded>)

And replace it with: \\1<br><br>\\2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM