Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed to select two lines then add HTML around those lines
    text
    copied!<p>Im trying to turn text into an HTML table and im stuck on the part to separate rows.</p> <p>Lets say I started with text that was displayed like this:</p> <blockquote> <p>1: a</p> <p>2: w</p> <p>3: p</p> </blockquote> <p>Then with a little bit of REGEX I turned it into</p> <pre><code>&lt;td&gt;1&lt;/td&gt; &lt;td&gt;a&lt;/td&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;w&lt;/td&gt; &lt;td&gt;3&lt;/td&gt; &lt;td&gt;p&lt;/td&gt; </code></pre> <p>Now how (with REGEX) would I turn that into this:</p> <pre><code>&lt;tr&gt; &lt;td&gt;1&lt;/td&gt; &lt;td&gt;a&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;w&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;3&lt;/td&gt; &lt;td&gt;p&lt;/td&gt; &lt;/tr&gt; </code></pre> <p><em>The indents are just there so you can see it better, I dont actually want it to add them.</em></p> <p>So somehow I would make it look for</p> <pre><code>&lt;td&gt;[0-9] </code></pre> <p>Then select that and the next line then add the and to it by doing</p> <pre><code>&lt;td&gt;\1&lt;\td&gt; </code></pre> <p>But I dont know how to do that entirely, if anyone can understand that mess could you help me please? D:</p> <p><strong>Edit:</strong> Worked it out!</p> <p>I started with</p> <blockquote> <p>1: a</p> <p>2: w</p> <p>3: p</p> </blockquote> <p>Then I did this:</p> <pre><code>Find: ": " Replace: "\r\n" </code></pre> <p>Then</p> <pre><code>Find: "([0-9])" Replace: "&lt;td&gt;\1&lt;td&gt;" </code></pre> <p>Then</p> <pre><code>Find: "^([^&lt;]+)$" Replace: "" </code></pre> <p>Then</p> <pre><code>Find: "(&lt;td&gt;[0-9]&lt;/td&gt;)[\r][\n]" Replace: "\1" </code></pre> <p>Huehuehue, then</p> <pre><code>Find: "^(.*&lt;td&gt;[0-9]*+)$" Replace: "&lt;tr&gt;\1&lt;/tr&gt;" </code></pre> <p>There was probably a MUCH easier way to do this, but I finally got it :D</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload