<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to replace - [X] *]]></title><description><![CDATA[<p dir="auto">Markdown checkbox<br />
Mine:</p>
<pre><code>// s is a string line.
if (s.startsWith("- [ ] "))
    s.replace("- [ ] ", "&lt;input type=\"checkbox\"&gt;");

if (s.startsWith("- [x] "))
    s.replace("- [x] ", "&lt;input type=\"checkbox\" checked&gt;");

if (s.startsWith("- [X] "))
    s.replace("- [X] ", "&lt;input type=\"checkbox\" checked&gt;");
</code></pre>
<p dir="auto">Target:</p>
<pre><code>// * means strings, add \n at line end
if (s.startsWith("- [ ] "))
    s.replace("- [ ] *", "&lt;input type=\"checkbox\"&gt;*\n");

if (s.startsWith("- [x] "))
    s.replace("- [x] *", "&lt;input type=\"checkbox\" checked&gt;*\n");

if (s.startsWith("- [X] "))
    s.replace("- [X] *", "&lt;input type=\"checkbox\" checked&gt;*\n");
</code></pre>
]]></description><link>https://forum.qt.io/topic/165210/how-to-replace-x</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 07:37:26 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/165210.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Oct 2026 02:11:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to replace - [X] * on Mon, 26 Oct 2026 11:07:04 GMT]]></title><description><![CDATA[<p dir="auto">Way 1 is more easy.</p>
]]></description><link>https://forum.qt.io/post/840599</link><guid isPermaLink="true">https://forum.qt.io/post/840599</guid><dc:creator><![CDATA[sonichy]]></dc:creator><pubDate>Mon, 26 Oct 2026 11:07:04 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace - [X] * on Mon, 26 Oct 2026 09:48:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sonichy">@<bdi>sonichy</bdi></a><br />
We could do this in a couple of ways:</p>
<pre><code>if (s.startsWith("- [ ] ")) {
    s.replace("- [ ] ", "&lt;input type=\"checkbox\"&gt;");
    s.append("\n");
}
</code></pre>
<p dir="auto">or</p>
<pre><code>s.replace(QRegularExpression("^- \\[ \\] (.*)$"), "&lt;input type=\"checkbox\"&gt;\\1\n");
</code></pre>
<p dir="auto"><em>However</em>, I suspect putting in a <code>\n</code> newline will not do what you want.  Per <a href="https://forum.qt.io/topic/165211/qtextbrowser.sethtml-do-not-support-input-type-checkbox">your other post and the linked picture there</a> I think you want these "items" on separate lines.  Remember that in HTML <code>\n</code> is just the same as any other <em>whitespace</em> character so it will just producer a space and stay on same line.  You probably want either to insert a <em>line break</em>, HTML <code>&lt;br&gt;</code>, or possibly put your items into some kind of HTML list (like <code>&lt;dl&gt; &lt;dt&gt;</code>).</p>
]]></description><link>https://forum.qt.io/post/840595</link><guid isPermaLink="true">https://forum.qt.io/post/840595</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 26 Oct 2026 09:48:17 GMT</pubDate></item></channel></rss>