﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ladysign Dev Blog &#187; modify multiple posts</title>
	<atom:link href="http://www.ladysign-apps.com/blog/tag/modify-multiple-posts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ladysign-apps.com/blog</link>
	<description>Girls can code.</description>
	<lastBuildDate>Mon, 01 Feb 2010 09:44:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Modify all Wordpress posts for syntax highlighter</title>
		<link>http://www.ladysign-apps.com/blog/code/wordpress/modify-all-wordpress-posts-for-syntax-highlighter/</link>
		<comments>http://www.ladysign-apps.com/blog/code/wordpress/modify-all-wordpress-posts-for-syntax-highlighter/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 10:56:11 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[change syntax highlight plugin]]></category>
		<category><![CDATA[modify multiple posts]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=903</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars<br />
I installed a new syntax highlighter for this blog.<br />
The thing is, with syntax highlighters that they all use their own pr[......]</p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars<br />
I installed a new syntax highlighter for this blog.<br />
The thing is, with syntax highlighters that they all use their own prefix.<br />
For example my previous one used the tags:</p>
<pre class="brush: xml;">&lt;pre lang=&quot;php&quot;&gt;echo &quot;this&quot;&lt;/pre&gt;</pre>
<p>My new highlighter plugin uses this:</p>
<pre class="brush: xml;">[code lang=&quot;php&quot;]echo &quot;this&quot;[/code</pre>
<p>Fine for me to start using this, but how can I modify all my 500 blog posts to the new syntax?<br />
Regex is the answer! What I did is, I first made a database export (sql) from all my wordpress posts in phpMyAdmin.<br />
I saved the sql query to my harddisk, and then opened it with a code editor (PSPad is good for regex).<br />
I replaced all:</p>
<pre class="brush: jscript;">//FIND
&lt;pre lang=&quot;(.+?)&quot;&gt;(.+?)&lt;/pre&gt;
//REPLACE
[code lang=&quot;$1&quot;]$2[/code</pre>
<p>Save the new query on your harddisk, which contains Wordpress post in the new format.<br />
In phpMyAdmin I emptied/truncated the "wp_post", table, so none of the posts where there.<br />
Then I imported the new query, and voila!<br />
My new syntax highlighter is working!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/wordpress/modify-all-wordpress-posts-for-syntax-highlighter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
