snipt

Ctrl+h for KB shortcuts

MySQL

Return text between delimiters in MySQL

1
2
3
4
5
SELECT 
  SUBSTR(column, 
    LOCATE(':',column)+1, 
      (CHAR_LENGTH(column) - LOCATE(':',REVERSE(column)) - LOCATE(':',column))) 
FROM table
https://snipt.net/embed/56ea271da0d3b88e9426456bbc66b14e/
/raw/56ea271da0d3b88e9426456bbc66b14e/
56ea271da0d3b88e9426456bbc66b14e
mysql
MySQL
5
2019-06-25T19:35:37
True
False
False
/api/public/snipt/3322/
return-text-between-delimiters-in-mysql
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">SELECT</span> </span><span id="L-2"><a name="L-2"></a> <span class="nf">SUBSTR</span><span class="p">(</span><span class="k">column</span><span class="p">,</span> </span><span id="L-3"><a name="L-3"></a> <span class="nf">LOCATE</span><span class="p">(</span><span class="s1">&#39;:&#39;</span><span class="p">,</span><span class="k">column</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> </span><span id="L-4"><a name="L-4"></a> <span class="p">(</span><span class="nf">CHAR_LENGTH</span><span class="p">(</span><span class="k">column</span><span class="p">)</span> <span class="o">-</span> <span class="nf">LOCATE</span><span class="p">(</span><span class="s1">&#39;:&#39;</span><span class="p">,</span><span class="nf">REVERSE</span><span class="p">(</span><span class="k">column</span><span class="p">))</span> <span class="o">-</span> <span class="nf">LOCATE</span><span class="p">(</span><span class="s1">&#39;:&#39;</span><span class="p">,</span><span class="k">column</span><span class="p">)))</span> </span><span id="L-5"><a name="L-5"></a><span class="k">FROM</span> <span class="k">table</span> </span></pre></div> </td></tr></table>
mysql

Bash

Tell TextMate to reload Bundles

osascript -e 'tell app "TextMate" to reload bundles'
https://snipt.net/embed/cc90e6bd14cee28f3ea6c5b18e9e522d/
/raw/cc90e6bd14cee28f3ea6c5b18e9e522d/
cc90e6bd14cee28f3ea6c5b18e9e522d
bash
Bash
1
2019-06-24T15:16:00
True
False
False
/api/public/snipt/2341/
tell-textmate-to-reload-bundles
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>osascript -e <span class="s1">&#39;tell app &quot;TextMate&quot; to reload bundles&#39;</span> </span></pre></div> </td></tr></table>
bundles, textmate