<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yoshiro Matsumoto</title>
    <description>The latest articles on DEV Community by Yoshiro Matsumoto (@myoshiro).</description>
    <link>https://dev.to/myoshiro</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F475998%2Fa048d23e-e781-4598-91c6-ccb8d182e645.png</url>
      <title>DEV Community: Yoshiro Matsumoto</title>
      <link>https://dev.to/myoshiro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/myoshiro"/>
    <language>en</language>
    <item>
      <title>Selector2Regexp - generating regular expressions from CSS selectors</title>
      <dc:creator>Yoshiro Matsumoto</dc:creator>
      <pubDate>Sun, 27 Sep 2020 07:43:48 +0000</pubDate>
      <link>https://dev.to/myoshiro/selector2regexp-generate-regular-expressions-from-css-selectors-2n5a</link>
      <guid>https://dev.to/myoshiro/selector2regexp-generate-regular-expressions-from-css-selectors-2n5a</guid>
      <description>&lt;p&gt;"&lt;a href="https://github.com/m-yoshiro/Selector2Regexp"&gt;Selector2Regexp&lt;/a&gt;" is a tiny tool that I released recently.&lt;br&gt;
It generates regular expressions of JavaScript from CSS selectors. The regular expressions are used for searching HTML elements matching with a given CSS selector.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It generates regular expressions using CSS Selectors.&lt;/li&gt;
&lt;li&gt;Commonly used selectors and combinators are supported.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Usage
&lt;/h1&gt;

&lt;p&gt;It is very straightforward.&lt;br&gt;
Only you have to do is to look up an html tag which is referenced by JavaScript or CSS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm i selector-2-regexp

&lt;span class="nv"&gt;$ &lt;/span&gt;s2r &lt;span class="s1"&gt;'.button'&lt;/span&gt;
&lt;span class="c"&gt;# =&amp;gt; &amp;lt;\s*([a-zA-Z]+)\s+.*(class=(?=['"])((?=(.*[\s'"]button[\s'"])).*)(?=['"])).*\s*&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  With clipboard
&lt;/h2&gt;

&lt;p&gt;It's convenient if you use it with any editor tools.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Save the result to clipboard.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;s2r &lt;span class="s1"&gt;'.button'&lt;/span&gt; | pbcopy
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;paste it on a search input of a editor(e.g. VS Code)&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ihf8Jo-f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/d6a6w8c3dg42jhvfscy7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ihf8Jo-f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/d6a6w8c3dg42jhvfscy7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Motivation
&lt;/h1&gt;

&lt;p&gt;I often refactor my frontend codes everyday and I have to look up a html tag which is referenced by JavaScript or CSS.&lt;br&gt;
I think that regular expression could be a better way to do that frequently but It was difficult for me to remember how to use them. I needed an easy way to achieve it.&lt;br&gt;
That is why I made Selector2Regexp.&lt;/p&gt;

&lt;p&gt;I hope this tool will help you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/m-yoshiro/Selector2Regexp"&gt;https://github.com/m-yoshiro/Selector2Regexp&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
