{"id":9833,"date":"2020-07-18T15:03:15","date_gmt":"2020-07-18T09:33:15","guid":{"rendered":"http:\/\/ivyproschool.com\/blog\/?p=9833"},"modified":"2021-06-10T15:03:34","modified_gmt":"2021-06-10T09:33:34","slug":"step-by-step-guide-of-python-regular-expressions-part-2","status":"publish","type":"post","link":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/","title":{"rendered":"Step By Step Guide of Python Regular Expressions &#8211; Part 2"},"content":{"rendered":"<p><a href=\"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-1\/\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\" wp-image-9819 aligncenter\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-5-300x139.png\" alt=\"Step by Step guide of python regular expressions\" width=\"495\" height=\"229\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-5-300x139.png 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-5-768x356.png 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-5-1024x474.png 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-5.png 1080w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/a><\/p>\n<p><a href=\" \"><br \/>\n<\/a><a href=\" \">This article is in continuation of our <\/a><a href=\"https:\/\/ivyproschool.com\/blog\/2020\/06\/24\/step-by-step-guide-to-python-regular-expressions\/\">first part<\/a> of a Step by Step guide of Python Regular Expressions. The meta-characters, special sequences,&nbsp; and sets are the essential parts of a regular expression. We are going to talk about working examples of these on the two-sample text data considered earlier. The movie review text is considered if someone is working on Topic Modelling. The Covit tweet sample is for NLP enthusiasts working on Sentiment Analysis.<\/p>\n<pre>movie_review = \"\"\"Troy is loosely based on Homer's 'Iliad', Wolfgang Petersen directs this epic war film, with an \r\nensemble cast including Brad Pitt, Eric Bana, Orlando Bloom, Diane Kruger, Troy Sean Bean, Brian Cox, Rose Byrne, \r\nGarrett Hedlund, Peter O' Toole, Brendan Gleeson, &amp; Tyler Mane.Troy is about love, power, deceit, valour, glory.\"\"\"\r\n\r\ncovid_tweet = \"\"\"As of today, the cumulative number of confirmed #COVID19 cases is 97 302,&nbsp;\r\ntotal number of #COVID19INDIA deaths is 1930 and the total number of recoveries is 51 608.\"\"\"<\/pre>\n<h2>Special Sequence \u2013<\/h2>\n<p>A special sequence is a <code class=\"w3-codespan\">\\<\/code> followed by one of the characters and has a special meaning. For example <strong>\\w, \\W, \\d, \\D<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-9820 aligncenter\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/8c83c588-18f5-4df5-8339-a9814f2b2662-1-300x180.jpg\" alt=\"Special Sequence\" width=\"533\" height=\"320\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/8c83c588-18f5-4df5-8339-a9814f2b2662-1-300x180.jpg 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/8c83c588-18f5-4df5-8339-a9814f2b2662-1-768x461.jpg 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/8c83c588-18f5-4df5-8339-a9814f2b2662-1-1024x614.jpg 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/8c83c588-18f5-4df5-8339-a9814f2b2662-1.jpg 1080w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><\/p>\n<p>Try to observe the information given in the snapshot provided above. Are you able to imagine some use cases for applying these special sequences in creating regular expressions?<\/p>\n<h3>Use case 1:<\/h3>\n<p>Assume every movie review pulled is carrying the movie name at the beginning of the review. The obvious choice would be to get rid of the movie&#8217;s name. We will apply a special sequence \\A to write the code. On the contrary, \\Z can be used if we are looking for a pattern at the end of our string.<\/p>\n<div>\n<div>\n<pre>re.sub(\"\\ATroy\",\"\",movie_review).strip()\r\nre.findall(\"Troy\\Z\",\"\",movie_review).strip()<\/pre>\n<\/div>\n<\/div>\n<h3>Use case 2:<\/h3>\n<p>In the covid_tweet, there are hashtags with #COVID19. If there is a requirement of identifying the presence of this pattern in the tweet, we can apply \\B<\/p>\n<div>\n<div>\n<pre>re.findall(r\"COVID\\B\",covid_tweet)\r\nre.sub(r\"COVID\\B\",\"COVID\",covid_tweet)<\/pre>\n<\/div>\n<div>If you are wondering what is the letter &#8216;r&#8217; in the second code, it is used to retain the raw string. Please visit <a href=\"https:\/\/ivyproschool.com\/blog\/2020\/06\/17\/string-operations-using-python-for-nlp-beginners\/\">this<\/a> blog to know more. Now let us proceed with other use cases where we can apply other special sequences.<\/div>\n<\/div>\n<h3>Use case 3:<\/h3>\n<p>Usually, any number present in a tweet is of no importance while performing Sentiment Analysis of tweets. To remove those, we can apply the below code using \\d. To find all the non-numerical and non-alphabetical characters at any stage in text cleaning, we can use \\W.<\/p>\n<div>\n<div>\n<pre>re.sub(r\"\\d\",\"\",covid_tweet).strip()\r\nre.findall(r\"\\W\",covid_tweet)<\/pre>\n<\/div>\n<\/div>\n<h2>Metacharacters and Sets &#8211;<\/h2>\n<p>These are characters with a special meaning and makes the application of regular expressions even more powerful. For example <strong>^<\/strong> <strong>$<\/strong> <strong>*<\/strong> <strong>+<\/strong> <strong>?<\/strong> <strong>{}<\/strong> <strong>()<\/strong> <strong>\\<\/strong> <strong>| .<br \/>\n<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-9791 aligncenter\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/cc7c2190-6b8e-451a-95cc-23b10e0210b2-300x147.jpg\" alt=\"Metacharacters - step by step guide of Python Regular Ex[ressions\" width=\"537\" height=\"263\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/cc7c2190-6b8e-451a-95cc-23b10e0210b2-300x147.jpg 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/cc7c2190-6b8e-451a-95cc-23b10e0210b2-768x375.jpg 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/cc7c2190-6b8e-451a-95cc-23b10e0210b2-1024x501.jpg 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/cc7c2190-6b8e-451a-95cc-23b10e0210b2.jpg 1080w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/><\/p>\n<p>Metacharacters impart even more flexibility and greater control over pattern identification. We will need to implement sets as well while generating regular expressions using metacharacters. Let us look at some interesting scenarios.<\/p>\n<h3>Use case 1:<\/h3>\n<p>If you notice a collection of tweets related to COVID, you will find many hashtags. Like #COVID19, #COVID2020, #COVID19INDIA, #COVID19PANDEMIC, and many more. To identify all the various types of such hashtags a tweet might comprise of, use [],{},+ metacharacters including sets 0-9, A-Z. A snapshot of sets is provided below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-9793 aligncenter\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/78baed9a-daec-45b4-9a4b-ec75f4cf546e-300x133.jpg\" alt=\"Sets of Regular Expression\" width=\"792\" height=\"351\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/78baed9a-daec-45b4-9a4b-ec75f4cf546e-300x133.jpg 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/78baed9a-daec-45b4-9a4b-ec75f4cf546e-768x341.jpg 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/78baed9a-daec-45b4-9a4b-ec75f4cf546e-1024x455.jpg 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/78baed9a-daec-45b4-9a4b-ec75f4cf546e.jpg 1080w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/p>\n<div>\n<pre>re.sub(r\"(#COVID[0-9]{2}[A-Z]+)|(#COVID[0-9]{2})\",\"\",covid_tweet)<\/pre>\n<\/div>\n<div>The + sign is used for greedy search. It searches for any number of occurrences of the preceding regular expression. In the above code, the + sign looks for capital letters. The {2} is to specify the occurrence of the preceding regular expression i.e. digits exactly two times. Now that you have understood the above use case, can you come up with a better regular expression code for it?<\/div>\n<div>\n<div>\n<pre>re.findall(r\"(#[A-Z0-9a-z]+)\",covid_tweet)<\/pre>\n<\/div>\n<\/div>\n<div>Interesting and powerful, is not it? But how? You must be wondering about the [A-Z0-9a-z] part of the above code, let me explain you. This means any digit or an upper or lower case alphabet succeeding a # sign. You already know the use of a + sign. Overall, the regular expression indicates that any number of occurrences of a digit or case insensitive alphabet after a # needs to be searched.<\/div>\n<h3>Use case 2:<\/h3>\n<p>In the movie_review string, there are various names like &#8220;Wolfgang Petersen&#8221;. Is there a way these names can be extracted? Give it a try before looking at the code below. Do let us know if you have a better solution.<\/p>\n<div>\n<div>\n<pre>re.findall(\"[A-Z][a-z]+ [A-Z][a-z]+\",movie_review)<\/pre>\n<\/div>\n<\/div>\n<h3>Use case 3:<\/h3>\n<div>There are several special characters in movie_review like &#8216; and ,. In order to remove them from the text, we need to run the below regular expression using the [^arn] example given in the sets snapshot provided above.<\/div>\n<div>\n<div>\n<pre>re.sub(\"([^0-9A-Za-z])\", \" \", movie_review)<\/pre>\n<\/div>\n<\/div>\n<div>\n<h2>Format Method-<\/h2>\n<p>Another interesting and useful string operation used in Python is the Format method applied to strings. It is used to format the specified value(s), insert them inside the string&#8217;s placeholder, and return the formatted string. The placeholder is defined using curly brackets: {}. The following are some types of formatting we can perform.<\/p>\n<h3>Single Formatting:<\/h3>\n<p>The {} will be replaced with the string &#8220;Enthusiast&#8221; in the below command.<\/p>\n<pre># default arguments\r\nprint(\"Hello {}, apply Decision Tree algorithm.\".format(\"Enthusiast\"))<\/pre>\n<h3>Multiple Formatting:<\/h3>\n<p>We also have the flexibility to provide several substitutions in a string. This is done by using multiple curly braces and mapping them with the required values. The following are some example commands.<\/p>\n<pre># default arguments\r\nprint(\"Hello {}, apply {} algorithm.\".format(\"Enthusiast\", \"Decision Tree\"))<\/pre>\n<p>By default, the command will replace braces with values in the sequence.<\/p>\n<pre>#&nbsp;positional&nbsp;arguments\r\nprint(\"Hello&nbsp;{0},&nbsp;apply&nbsp;{1}&nbsp;algorithm.\".format(\"Enthusiast\",&nbsp;\"Decision&nbsp;Tree\"))<\/pre>\n<p>The positional arguments give us better control over where we want to replace the values. We are using positions 0 and 1 in this example.<\/p>\n<pre>#&nbsp;keyword&nbsp;arguments\r\nprint(\"Hello&nbsp;{name},&nbsp;apply&nbsp;{algo}&nbsp;algorithm.\".format(name=\"Enthusiast\",&nbsp;algo=\"Decision&nbsp;Tree\"))<\/pre>\n<p>keyword arguments go by variable names as shown above.<\/p>\n<pre># Mixed arguments\r\nprint(\"Hello&nbsp;{0},&nbsp;apply&nbsp;{algo}&nbsp;algorithm.\".format(\"Enthusiast\",&nbsp;algo=\"Decision&nbsp;Tree\"))<\/pre>\n<p>Needs no explanation. We can use positional as well as keyword arguments in a single format command.<\/p>\n<p>Many other string operations are explained in our article Basic String Operations. We hope by now you are comfortable and confident with Regular expressions and String Operations. It is highly encouraged that you practice these as much as possible. We are going to cover the NLP concept named Text tokenization comprising of the sentence and word tokenization in our next article. Stay tuned. Happy Learning!!!<\/p>\n<\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article is in continuation of our first part of a Step by Step guide of Python Regular Expressions. The meta-characters, special sequences,&nbsp; and sets are the essential parts of a regular expression. We are going to talk about working examples of these on the two-sample text data considered earlier. The movie review text is considered if someone is working on Topic Modelling. The Covit tweet sample is for NLP enthusiasts working on Sentiment Analysis. movie_review = &#8220;&#8221;&#8221;Troy is loosely based on Homer&#8217;s &#8216;Iliad&#8217;, Wolfgang Petersen directs this epic war film, with an ensemble cast including Brad Pitt, Eric Bana, Orlando Bloom, Diane Kruger, Troy Sean Bean, Brian Cox, Rose Byrne, Garrett Hedlund, Peter O&#8217; Toole, Brendan Gleeson, &amp; Tyler Mane.Troy is about love, power, deceit, valour, glory.&#8221;&#8221;&#8221; covid_tweet = &#8220;&#8221;&#8221;As of today, the cumulative number of confirmed #COVID19 cases is 97 302,&nbsp; total number of #COVID19INDIA deaths is 1930 and the total number of recoveries is 51 608.&#8221;&#8221;&#8221; Special Sequence \u2013 A special sequence is a \\ followed by one of the characters and has a special meaning. For example \\w, \\W, \\d, \\D Try to observe the information given in the snapshot provided above. Are you able to [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":9816,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,550],"tags":[22,43,56,76,294,467,511,504,716],"class_list":["post-9833","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-analytics","category-interview","tag-analytics","tag-big-data","tag-big-data-analytics","tag-business-analytics","tag-data-mining","tag-data-science","tag-ivy-professional-school","tag-machine-learning","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Step By Step Guide of Python Regular Expressions | Ivy Pro School<\/title>\n<meta name=\"description\" content=\"This article is the second part of Step By Step Guide of Python Regular Expressions. We discuss Metacharacters, Special sequences and Sets.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Step By Step Guide of Python Regular Expressions | Ivy Pro School\" \/>\n<meta property=\"og:description\" content=\"This article is the second part of Step By Step Guide of Python Regular Expressions. We discuss Metacharacters, Special sequences and Sets.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/\" \/>\n<meta property=\"og:site_name\" content=\"R vs Python: Which Analytics Tool Should You Choose for Data Science?\" \/>\n<meta property=\"article:author\" content=\"https:\/\/facebook.com\/ivyproschool\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-18T09:33:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-10T09:33:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ivy Professional School\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ivyproschool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ivy Professional School\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/\"},\"author\":{\"name\":\"Ivy Professional School\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#\\\/schema\\\/person\\\/31fdab8559dd3db99173764bfb60215d\"},\"headline\":\"Step By Step Guide of Python Regular Expressions &#8211; Part 2\",\"datePublished\":\"2020-07-18T09:33:15+00:00\",\"dateModified\":\"2021-06-10T09:33:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/\"},\"wordCount\":881,\"image\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/Blog-2.png\",\"keywords\":[\"Analytics\",\"Big Data\",\"Big Data analytics\",\"business analytics\",\"data mining\",\"data science\",\"IVY Professional School\",\"machine learning\",\"python\"],\"articleSection\":[\"Data Analytics\",\"Interviews\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/\",\"url\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/\",\"name\":\"Step By Step Guide of Python Regular Expressions | Ivy Pro School\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/Blog-2.png\",\"datePublished\":\"2020-07-18T09:33:15+00:00\",\"dateModified\":\"2021-06-10T09:33:34+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#\\\/schema\\\/person\\\/31fdab8559dd3db99173764bfb60215d\"},\"description\":\"This article is the second part of Step By Step Guide of Python Regular Expressions. We discuss Metacharacters, Special sequences and Sets.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/#primaryimage\",\"url\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/Blog-2.png\",\"contentUrl\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/Blog-2.png\",\"width\":1080,\"height\":500,\"caption\":\"python regular expressions\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/step-by-step-guide-of-python-regular-expressions-part-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Step By Step Guide of Python Regular Expressions &#8211; Part 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/\",\"name\":\"Ivy Professional School | Official Blog\",\"description\":\"Confused between R and Python for your data science journey? Discover the key differences in data visualization, handling capabilities, speed, and ease of learning.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#\\\/schema\\\/person\\\/31fdab8559dd3db99173764bfb60215d\",\"name\":\"Ivy Professional School\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g\",\"caption\":\"Ivy Professional School\"},\"sameAs\":[\"http:\\\/\\\/www.ivyproschool.com\",\"https:\\\/\\\/facebook.com\\\/ivyproschool\",\"https:\\\/\\\/instagram.com\\\/ivyproschool\",\"https:\\\/\\\/x.com\\\/ivyproschool\",\"https:\\\/\\\/youtube.com\\\/ivyproschool\"],\"url\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/author\\\/prateek\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Step By Step Guide of Python Regular Expressions | Ivy Pro School","description":"This article is the second part of Step By Step Guide of Python Regular Expressions. We discuss Metacharacters, Special sequences and Sets.","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:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/","og_locale":"en_US","og_type":"article","og_title":"Step By Step Guide of Python Regular Expressions | Ivy Pro School","og_description":"This article is the second part of Step By Step Guide of Python Regular Expressions. We discuss Metacharacters, Special sequences and Sets.","og_url":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/","og_site_name":"R vs Python: Which Analytics Tool Should You Choose for Data Science?","article_author":"https:\/\/facebook.com\/ivyproschool","article_published_time":"2020-07-18T09:33:15+00:00","article_modified_time":"2021-06-10T09:33:34+00:00","og_image":[{"width":1080,"height":500,"url":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-2.png","type":"image\/png"}],"author":"Ivy Professional School","twitter_card":"summary_large_image","twitter_creator":"@ivyproschool","twitter_misc":{"Written by":"Ivy Professional School","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/#article","isPartOf":{"@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/"},"author":{"name":"Ivy Professional School","@id":"https:\/\/ivyproschool.com\/blog\/#\/schema\/person\/31fdab8559dd3db99173764bfb60215d"},"headline":"Step By Step Guide of Python Regular Expressions &#8211; Part 2","datePublished":"2020-07-18T09:33:15+00:00","dateModified":"2021-06-10T09:33:34+00:00","mainEntityOfPage":{"@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/"},"wordCount":881,"image":{"@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-2.png","keywords":["Analytics","Big Data","Big Data analytics","business analytics","data mining","data science","IVY Professional School","machine learning","python"],"articleSection":["Data Analytics","Interviews"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/","url":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/","name":"Step By Step Guide of Python Regular Expressions | Ivy Pro School","isPartOf":{"@id":"https:\/\/ivyproschool.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/#primaryimage"},"image":{"@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-2.png","datePublished":"2020-07-18T09:33:15+00:00","dateModified":"2021-06-10T09:33:34+00:00","author":{"@id":"https:\/\/ivyproschool.com\/blog\/#\/schema\/person\/31fdab8559dd3db99173764bfb60215d"},"description":"This article is the second part of Step By Step Guide of Python Regular Expressions. We discuss Metacharacters, Special sequences and Sets.","breadcrumb":{"@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/#primaryimage","url":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-2.png","contentUrl":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Blog-2.png","width":1080,"height":500,"caption":"python regular expressions"},{"@type":"BreadcrumbList","@id":"https:\/\/ivyproschool.com\/blog\/step-by-step-guide-of-python-regular-expressions-part-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ivyproschool.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Step By Step Guide of Python Regular Expressions &#8211; Part 2"}]},{"@type":"WebSite","@id":"https:\/\/ivyproschool.com\/blog\/#website","url":"https:\/\/ivyproschool.com\/blog\/","name":"Ivy Professional School | Official Blog","description":"Confused between R and Python for your data science journey? Discover the key differences in data visualization, handling capabilities, speed, and ease of learning.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ivyproschool.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ivyproschool.com\/blog\/#\/schema\/person\/31fdab8559dd3db99173764bfb60215d","name":"Ivy Professional School","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g","caption":"Ivy Professional School"},"sameAs":["http:\/\/www.ivyproschool.com","https:\/\/facebook.com\/ivyproschool","https:\/\/instagram.com\/ivyproschool","https:\/\/x.com\/ivyproschool","https:\/\/youtube.com\/ivyproschool"],"url":"https:\/\/ivyproschool.com\/blog\/author\/prateek\/"}]}},"_links":{"self":[{"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/posts\/9833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/comments?post=9833"}],"version-history":[{"count":1,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/posts\/9833\/revisions"}],"predecessor-version":[{"id":10564,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/posts\/9833\/revisions\/10564"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/media\/9816"}],"wp:attachment":[{"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/media?parent=9833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/categories?post=9833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/tags?post=9833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}