<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Jquery Regex on Jeremy Jackson</title>
    <link>https://new.tsjee.ru/tags/jquery-regex/</link>
    <description>Recent content in Jquery Regex on Jeremy Jackson</description>
    <generator>Hugo</generator>
    <language>ru</language>
    <lastBuildDate>Tue, 23 Aug 2011 05:49:13 +0000</lastBuildDate>
    <atom:link href="https://new.tsjee.ru/tags/jquery-regex/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Использование регулярных выражений в jQuery</title>
      <link>https://new.tsjee.ru/posts/2011-08-23-%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D1%80%D0%B5%D0%B3%D1%83%D0%BB%D1%8F%D1%80%D0%BD%D1%8B%D1%85-%D0%B2%D1%8B%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B9-%D0%B2-jquery/</link>
      <pubDate>Tue, 23 Aug 2011 05:49:13 +0000</pubDate>
      <guid>https://new.tsjee.ru/posts/2011-08-23-%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D1%80%D0%B5%D0%B3%D1%83%D0%BB%D1%8F%D1%80%D0%BD%D1%8B%D1%85-%D0%B2%D1%8B%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B9-%D0%B2-jquery/</guid>
      <description>&lt;p&gt;Для использования регулярных выражений, без которых иногда просто не обойтись, можно пользоваться следующим сниппетом:&lt;/p&gt;&#xA;&lt;p&gt;/&lt;em&gt;for regex in jquery&lt;/em&gt;/&lt;/p&gt;&#xA;&lt;p&gt;jQuery.expr[&amp;rsquo;:&amp;rsquo;].regex = function(elem, index, match) {&lt;/p&gt;&#xA;&lt;p&gt;var matchParams = match[3].split(&amp;rsquo;,&amp;rsquo;),&lt;/p&gt;&#xA;&lt;p&gt;validLabels = /^(data|css):/,&lt;/p&gt;&#xA;&lt;p&gt;attr = {&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  method: matchParams[0].match(validLabels) ? matchParams[0].split(&#39;:&#39;)[0] : &#39;attr&#39;,&#xA;&#xA;  property: matchParams.shift().replace(validLabels,&#39;&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;},&lt;/p&gt;&#xA;&lt;p&gt;regexFlags = &amp;lsquo;ig&amp;rsquo;,&lt;/p&gt;&#xA;&lt;p&gt;regex = new RegExp(matchParams.join(&amp;rsquo;&amp;rsquo;).replace(/^\s+|\s+$/g,&amp;rsquo;&amp;rsquo;), regexFlags);&lt;/p&gt;&#xA;&lt;p&gt;return regex.test(jQuery(elem)&lt;a href=&#34;attr.property&#34;&gt;attr.method&lt;/a&gt;);&lt;/p&gt;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&lt;p&gt;Пример использования:&lt;/p&gt;&#xA;&lt;p&gt;$(&amp;ldquo;input:regex(id, ^edit-field-sud-value-&amp;rdquo; + s[4] + &amp;ldquo;-children-.*)&amp;rdquo;).attr(&amp;lsquo;checked&amp;rsquo;, &amp;lsquo;checked&amp;rsquo;);&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
