{"id":369,"date":"2023-09-09T15:01:54","date_gmt":"2023-09-09T15:01:54","guid":{"rendered":"https:\/\/softwaretestingstuff.com\/?p=369"},"modified":"2023-09-10T10:08:26","modified_gmt":"2023-09-10T10:08:26","slug":"ways-to-create-regular-expressions-in-qtp","status":"publish","type":"post","link":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html","title":{"rendered":"Ways to create Regular Expressions in QTP"},"content":{"rendered":"\n

In QTP, there are multiple ways to create Regular Expressions. Below are most common 15 different ways to create Regular Expressions:
<\/a><\/p>\n\n\n\n

    \n
  1. Using the Backslash Character: <\/strong>A backslash (\\) can serve two purposes. It can be used in conjunction with a special character to indicate that the next character be treated as a literal character. For example, \\.would be treated as period (.) instead of a wildcard. Alternatively, if the backslash (\\) is used in conjunction with some characters that would otherwise be treated as literal characters, such as the letters n, t, w, or d, the combination indicates a special character. For example, \\n stands for the newline character.<\/li>\n\n\n\n
  2. Matching Any Single Character: <\/strong>A period (.) instructs QTP to search for any single character (except for \\n).<\/li>\n\n\n\n
  3. Matching Any Single Character in a List: <\/strong>Square brackets instruct QTP to search for any single character within a list of characters.<\/li>\n\n\n\n
  4. Matching Any Single Character Not in a List: <\/strong>When a caret (^) is the first character inside square brackets, it instructs QTP to match any character in the list except for the ones specified in the string.<\/li>\n\n\n\n
  5. Matching Any Single Character within a Range: <\/strong>To match a single character within a range, you can use square brackets ([ ]) with the hyphen (-) character.<\/li>\n\n\n\n
  6. Matching Zero or More Specific Characters: <\/strong>An asterisk (*) instructs QTP to match zero or more occurrences of the preceding character.<\/li>\n\n\n\n
  7. Matching One or More Specific Characters: <\/strong>A plus sign (+) instructs QTP to match one or more occurrences of the preceding character.<\/li>\n\n\n\n
  8. Matching Zero or One Specific Character: <\/strong>A question mark (?) instructs QTP to match zero or one occurrences of the preceding character.<\/li>\n\n\n\n
  9. Grouping Regular Expressions: <\/strong>Parentheses (()) instruct QTP to treat the contained sequence as a unit, just as in mathematics and programming languages. Using groups is especially useful for delimiting the argument(s) to an alternation operator ( | ) or a repetition operator ( * , + , ? , { } ).<\/li>\n\n\n\n
  10. Matching One of Several Regular Expressions: <\/strong>A vertical line (|) instructs QTP to match one of a choice of expressions.<\/li>\n\n\n\n
  11. Matching the Beginning of a Line: <\/strong>A caret (^) instructs QTP to match the expression only at the start of a line, or after a newline character.<\/li>\n\n\n\n
  12. Matching the End of a Line: <\/strong>A dollar sign ($) instructs QTP to match the expression only at the end of a line, or before a newline character.<\/li>\n\n\n\n
  13. Matching Any AlphaNumeric Character Including the Underscore: <\/strong>\\w instructs QTP to match any alphanumeric character and the underscore (A-Z, a-z, 0-9, _).<\/li>\n\n\n\n
  14. Matching Any Non-AlphaNumeric Character: <\/strong>\\W instructs QTP to match any character other than alphanumeric characters and underscores.<\/li>\n\n\n\n
  15. Combining Regular Expression Operators:<\/strong> You can combine regular expression operators in a single expression to achieve the exact search criteria you need.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"

    In QTP, there are multiple ways to create Regular Expressions. Below are most common 15 different ways to create Regular Expressions:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[14],"tags":[],"table_tags":[],"class_list":["post-369","post","type-post","status-publish","format-standard","hentry","category-software-testing-certification"],"yoast_head":"\nWays to create Regular Expressions in QTP - Software Testing Stuff<\/title>\n<meta name=\"description\" content=\"Want to create powerful regular expressions that work like magic? Discover the top ways to master regex and streamline your coding process. Click now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ways to create Regular Expressions in QTP - Software Testing Stuff\" \/>\n<meta property=\"og:description\" content=\"Want to create powerful regular expressions that work like magic? Discover the top ways to master regex and streamline your coding process. Click now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html\" \/>\n<meta property=\"og:site_name\" content=\"Software Testing Stuff\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/tdipto\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-09T15:01:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-10T10:08:26+00:00\" \/>\n<meta name=\"author\" content=\"Rahnuma Tasnim\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@tanvir@softwaretestingstuff.com\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rahnuma Tasnim\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html\"},\"author\":{\"name\":\"Rahnuma Tasnim\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#\/schema\/person\/89d98848f9f47c2c4397c8b6b05c739b\"},\"headline\":\"Ways to create Regular Expressions in QTP\",\"datePublished\":\"2023-09-09T15:01:54+00:00\",\"dateModified\":\"2023-09-10T10:08:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html\"},\"wordCount\":460,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#organization\"},\"articleSection\":[\"Software Testing Certification\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html\",\"url\":\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html\",\"name\":\"Ways to create Regular Expressions in QTP - Software Testing Stuff\",\"isPartOf\":{\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#website\"},\"datePublished\":\"2023-09-09T15:01:54+00:00\",\"dateModified\":\"2023-09-10T10:08:26+00:00\",\"description\":\"Want to create powerful regular expressions that work like magic? Discover the top ways to master regex and streamline your coding process. Click now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.softwaretestingstuff.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ways to create Regular Expressions in QTP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#website\",\"url\":\"https:\/\/www.softwaretestingstuff.com\/\",\"name\":\"Software Testing Stuff\",\"description\":\"Unlock the power of efficient testing and elevate your testing game\",\"publisher\":{\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.softwaretestingstuff.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#organization\",\"name\":\"Software Testing Stuff\",\"url\":\"https:\/\/www.softwaretestingstuff.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.softwaretestingstuff.com\/wp-content\/uploads\/2022\/12\/logo-sts.png\",\"contentUrl\":\"https:\/\/www.softwaretestingstuff.com\/wp-content\/uploads\/2022\/12\/logo-sts.png\",\"width\":3268,\"height\":455,\"caption\":\"Software Testing Stuff\"},\"image\":{\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#\/schema\/person\/89d98848f9f47c2c4397c8b6b05c739b\",\"name\":\"Rahnuma Tasnim\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.softwaretestingstuff.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/41c8421a46bfdc7a8c3777359a8ce20e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/41c8421a46bfdc7a8c3777359a8ce20e?s=96&d=mm&r=g\",\"caption\":\"Rahnuma Tasnim\"},\"description\":\"Rahnuma is a technical content writer at software testing stuff. A software engineer by degree and a dynamic content creator by passion, she brings to table over 3 years of writing experience in tech niche. Combining her enthusiasm for writing and technology, she loves to share her thoughts on the latest tech trends.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/rahnuma-tasnim-770402216\/\",\"https:\/\/www.facebook.com\/tdipto\",\"https:\/\/x.com\/tanvir@softwaretestingstuff.com\"],\"url\":\"https:\/\/www.softwaretestingstuff.com\/author\/tanvirsoftwaretestingstuff-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ways to create Regular Expressions in QTP - Software Testing Stuff","description":"Want to create powerful regular expressions that work like magic? Discover the top ways to master regex and streamline your coding process. Click now!","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:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html","og_locale":"en_US","og_type":"article","og_title":"Ways to create Regular Expressions in QTP - Software Testing Stuff","og_description":"Want to create powerful regular expressions that work like magic? Discover the top ways to master regex and streamline your coding process. Click now!","og_url":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html","og_site_name":"Software Testing Stuff","article_author":"https:\/\/www.facebook.com\/tdipto","article_published_time":"2023-09-09T15:01:54+00:00","article_modified_time":"2023-09-10T10:08:26+00:00","author":"Rahnuma Tasnim","twitter_card":"summary_large_image","twitter_creator":"@tanvir@softwaretestingstuff.com","twitter_misc":{"Written by":"Rahnuma Tasnim","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html#article","isPartOf":{"@id":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html"},"author":{"name":"Rahnuma Tasnim","@id":"https:\/\/www.softwaretestingstuff.com\/#\/schema\/person\/89d98848f9f47c2c4397c8b6b05c739b"},"headline":"Ways to create Regular Expressions in QTP","datePublished":"2023-09-09T15:01:54+00:00","dateModified":"2023-09-10T10:08:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html"},"wordCount":460,"commentCount":0,"publisher":{"@id":"https:\/\/www.softwaretestingstuff.com\/#organization"},"articleSection":["Software Testing Certification"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html","url":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html","name":"Ways to create Regular Expressions in QTP - Software Testing Stuff","isPartOf":{"@id":"https:\/\/www.softwaretestingstuff.com\/#website"},"datePublished":"2023-09-09T15:01:54+00:00","dateModified":"2023-09-10T10:08:26+00:00","description":"Want to create powerful regular expressions that work like magic? Discover the top ways to master regex and streamline your coding process. Click now!","breadcrumb":{"@id":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.softwaretestingstuff.com\/2013\/08\/ways-to-create-regular-expressions-in.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.softwaretestingstuff.com\/"},{"@type":"ListItem","position":2,"name":"Ways to create Regular Expressions in QTP"}]},{"@type":"WebSite","@id":"https:\/\/www.softwaretestingstuff.com\/#website","url":"https:\/\/www.softwaretestingstuff.com\/","name":"Software Testing Stuff","description":"Unlock the power of efficient testing and elevate your testing game","publisher":{"@id":"https:\/\/www.softwaretestingstuff.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.softwaretestingstuff.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.softwaretestingstuff.com\/#organization","name":"Software Testing Stuff","url":"https:\/\/www.softwaretestingstuff.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.softwaretestingstuff.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.softwaretestingstuff.com\/wp-content\/uploads\/2022\/12\/logo-sts.png","contentUrl":"https:\/\/www.softwaretestingstuff.com\/wp-content\/uploads\/2022\/12\/logo-sts.png","width":3268,"height":455,"caption":"Software Testing Stuff"},"image":{"@id":"https:\/\/www.softwaretestingstuff.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.softwaretestingstuff.com\/#\/schema\/person\/89d98848f9f47c2c4397c8b6b05c739b","name":"Rahnuma Tasnim","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.softwaretestingstuff.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/41c8421a46bfdc7a8c3777359a8ce20e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/41c8421a46bfdc7a8c3777359a8ce20e?s=96&d=mm&r=g","caption":"Rahnuma Tasnim"},"description":"Rahnuma is a technical content writer at software testing stuff. A software engineer by degree and a dynamic content creator by passion, she brings to table over 3 years of writing experience in tech niche. Combining her enthusiasm for writing and technology, she loves to share her thoughts on the latest tech trends.","sameAs":["https:\/\/www.linkedin.com\/in\/rahnuma-tasnim-770402216\/","https:\/\/www.facebook.com\/tdipto","https:\/\/x.com\/tanvir@softwaretestingstuff.com"],"url":"https:\/\/www.softwaretestingstuff.com\/author\/tanvirsoftwaretestingstuff-com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/posts\/369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/comments?post=369"}],"version-history":[{"count":0,"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/posts\/369\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/media?parent=369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/categories?post=369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/tags?post=369"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/www.softwaretestingstuff.com\/wp-json\/wp\/v2\/table_tags?post=369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}