{"id":114,"date":"2018-04-18T21:42:00","date_gmt":"2018-04-18T21:42:00","guid":{"rendered":"https:\/\/seimith.io\/?p=114"},"modified":"2024-07-20T00:20:10","modified_gmt":"2024-07-20T00:20:10","slug":"check-for-color-with-regex","status":"publish","type":"post","link":"https:\/\/seimith.io\/pt\/2018\/04\/18\/check-for-color-with-regex\/","title":{"rendered":"Check for color with Regex"},"content":{"rendered":"<p>Hey, are you in need of checking if a string is&nbsp;<code>hex, rgb, rgba, hsl, and hsla<\/code>? Look no further.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(^&#91;a-zA-Z]+$)|(#(?:&#91;0-9a-f]{2}){2,4}|#&#91;0-9a-f]{3}|(?:rgba?|hsla?)\\((?:\\d+%?(?:deg|rad|grad|turn)?(?:,|\\s)+){2,3}&#91;\\s\\\/]*&#91;\\d\\.]+%?\\))<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/(\n      #(?:&#91;0-9a-f]{2}){2,4}               Match #ARGB, #RRGGBB, or #AARRGGBB\n   |                                   or\n      #&#91;0-9a-f]{3}                        Match #RGB\n   |                                   or\n      (^&#91;a-zA-Z]+$)                       Match any string (red, green, blue)\n   |                                   or\n      (?:rgba?|hsla?)                     Match hsl, rgb, hsla, or rgba\n      \\(                                  Match (\n         (\n            ?:\\d+%?(?:deg|rad|grad|turn)?    Match 0, 0%, 00%, 0deg, 0rad, etc.\n            (?:,|\\s)+                        Match a comma and\/or space to separate them\n         ){2,3}                           Repeat 2 or 3 times\n         &#91;\\s\\\/]*&#91;\\d\\.]+%?                 Match the last value, period and slash allowed\n      \\)                                  Match )\n)\/<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/regexr.com\/3omin\">Regexr Example<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Hey, are you in need of checking if a string is&nbsp;hex, rgb, rgba, hsl, and hsla? Look no further. Regexr Example<\/p>","protected":false},"author":1,"featured_media":288,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[20],"class_list":["post-114","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-post","tag-code"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Check for color with Regex - S(ei)mith.io<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/seimith.io\/pt\/2018\/04\/18\/check-for-color-with-regex\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Check for color with Regex - S(ei)mith.io\" \/>\n<meta property=\"og:description\" content=\"Hey, are you in need of checking if a string is&nbsp;hex, rgb, rgba, hsl, and hsla? Look no further. Regexr Example\" \/>\n<meta property=\"og:url\" content=\"https:\/\/seimith.io\/pt\/2018\/04\/18\/check-for-color-with-regex\/\" \/>\n<meta property=\"og:site_name\" content=\"S(ei)mith.io\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-18T21:42:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-20T00:20:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t<meta property=\"og:image:height\" content=\"700\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Smith\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smith\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/\"},\"author\":{\"name\":\"Smith\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\"},\"headline\":\"Check for color with Regex\",\"datePublished\":\"2018-04-18T21:42:00+00:00\",\"dateModified\":\"2024-07-20T00:20:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/\"},\"wordCount\":22,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"keywords\":[\"Code\"],\"articleSection\":[\"Post\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/\",\"url\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/\",\"name\":\"Check for color with Regex - S(ei)mith.io\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"datePublished\":\"2018-04-18T21:42:00+00:00\",\"dateModified\":\"2024-07-20T00:20:10+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/#primaryimage\",\"url\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"contentUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"width\":700,\"height\":700},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2018\\\/04\\\/18\\\/check-for-color-with-regex\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/seimith.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Check for color with Regex\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#website\",\"url\":\"https:\\\/\\\/seimith.io\\\/\",\"name\":\"s(ei)mith.io\",\"description\":\"Ramblings written by\u00a0Smith Suth\u00a0who works at the intersection of Engineering, Product, and Design.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/seimith.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\",\"name\":\"Smith\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"caption\":\"Smith\"},\"sameAs\":[\"https:\\\/\\\/seimith.io\"],\"url\":\"https:\\\/\\\/seimith.io\\\/pt\\\/author\\\/seimithsuth\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Check for color with Regex - S(ei)mith.io","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/seimith.io\/pt\/2018\/04\/18\/check-for-color-with-regex\/","og_locale":"pt_BR","og_type":"article","og_title":"Check for color with Regex - S(ei)mith.io","og_description":"Hey, are you in need of checking if a string is&nbsp;hex, rgb, rgba, hsl, and hsla? Look no further. Regexr Example","og_url":"https:\/\/seimith.io\/pt\/2018\/04\/18\/check-for-color-with-regex\/","og_site_name":"S(ei)mith.io","article_published_time":"2018-04-18T21:42:00+00:00","article_modified_time":"2024-07-20T00:20:10+00:00","og_image":[{"width":700,"height":700,"url":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","type":"image\/webp"}],"author":"Smith","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smith","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/#article","isPartOf":{"@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/"},"author":{"name":"Smith","@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a"},"headline":"Check for color with Regex","datePublished":"2018-04-18T21:42:00+00:00","dateModified":"2024-07-20T00:20:10+00:00","mainEntityOfPage":{"@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/"},"wordCount":22,"commentCount":0,"image":{"@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/#primaryimage"},"thumbnailUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","keywords":["Code"],"articleSection":["Post"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/","url":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/","name":"Check for color with Regex - S(ei)mith.io","isPartOf":{"@id":"https:\/\/seimith.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/#primaryimage"},"image":{"@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/#primaryimage"},"thumbnailUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","datePublished":"2018-04-18T21:42:00+00:00","dateModified":"2024-07-20T00:20:10+00:00","author":{"@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a"},"breadcrumb":{"@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/#primaryimage","url":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","contentUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","width":700,"height":700},{"@type":"BreadcrumbList","@id":"https:\/\/seimith.io\/2018\/04\/18\/check-for-color-with-regex\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/seimith.io\/"},{"@type":"ListItem","position":2,"name":"Check for color with Regex"}]},{"@type":"WebSite","@id":"https:\/\/seimith.io\/#website","url":"https:\/\/seimith.io\/","name":"s(ei)mith.io","description":"Ramblings written by\u00a0Smith Suth\u00a0who works at the intersection of Engineering, Product, and Design.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/seimith.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Person","@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a","name":"Smith","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","caption":"Smith"},"sameAs":["https:\/\/seimith.io"],"url":"https:\/\/seimith.io\/pt\/author\/seimithsuth\/"}]}},"_links":{"self":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/comments?post=114"}],"version-history":[{"count":1,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":115,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/114\/revisions\/115"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/media\/288"}],"wp:attachment":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/media?parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/categories?post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/tags?post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}