snipt

Ctrl+h for KB shortcuts

JavaScript

email regex check

1
2
3
4
5
6
7
8
function checkemail(){
	var str=document.validation.emailcheck.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str))
		testresults=true
	else
		testresults=false
}
https://snipt.net/embed/3a424f02682b7d53ca0fba312e8ba5f2/
/raw/3a424f02682b7d53ca0fba312e8ba5f2/
3a424f02682b7d53ca0fba312e8ba5f2
js
JavaScript
8
2019-06-14T02:50:56
True
False
False
/api/public/snipt/22928/
email-regex-check
<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> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">function</span> <span class="nx">checkemail</span><span class="p">(){</span> </span><span id="L-2"><a name="L-2"></a> <span class="kd">var</span> <span class="nx">str</span><span class="o">=</span><span class="nb">document</span><span class="p">.</span><span class="nx">validation</span><span class="p">.</span><span class="nx">emailcheck</span><span class="p">.</span><span class="nx">value</span> </span><span id="L-3"><a name="L-3"></a> <span class="kd">var</span> <span class="nx">filter</span><span class="o">=</span><span class="sr">/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">if</span> <span class="p">(</span><span class="nx">filter</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">str</span><span class="p">))</span> </span><span id="L-5"><a name="L-5"></a> <span class="nx">testresults</span><span class="o">=</span><span class="kc">true</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">else</span> </span><span id="L-7"><a name="L-7"></a> <span class="nx">testresults</span><span class="o">=</span><span class="kc">false</span> </span><span id="L-8"><a name="L-8"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
check, email, regex

Bash

Find/Replace text in files

find . -name "*.php"|xargs perl -w -i -p -e "s/Perl is good/perl is great/g"
https://snipt.net/embed/16f83c23f2c53a07651de2bb63495a2c/
/raw/16f83c23f2c53a07651de2bb63495a2c/
16f83c23f2c53a07651de2bb63495a2c
bash
Bash
2
2019-06-16T11:30:50
True
False
False
/api/public/snipt/22055/
findreplace-text-in-files
<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>find . -name <span class="s2">&quot;*.php&quot;</span><span class="p">|</span>xargs perl -w -i -p -e <span class="s2">&quot;s/Perl is good/perl is great/g&quot;</span> </span></pre></div> </td></tr></table>
find, linux, perl, replace