[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571363-105":53,"doc-detail-571363-en":127},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","javascript-regex-cheat-sheet-part-3-quick-reference","JavaScript Regex Cheat Sheet - Part 3 - Quick reference","","JavaScript Regex Cheat Sheet provides a practical reference for building and using regular expressions in JavaScript. It explains two ways to create regex patterns (literal syntax and the RegExp constructor), then covers matching character sets, word/digit/whitespace classes, and word-boundary behavior. The guide also includes operators for repetition and anchors for line or string boundaries, plus common regex flags and core methods such as test, match, replace, and split.",{"@graph":63,"@context":119},[64,80,102],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":51,"@type":70,"position":76},"https://docshare.wps.com/template/general/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/javascript-regex-cheat-sheet-part-3-quick-reference/571363/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/javascript-regex-cheat-sheet-part-3-quick-reference/571363.png","ImageObject",442,249,{"name":88,"@type":89},"iuabcfuw","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-23","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",9,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"How do you define a regular expression in JavaScript?","Question",{"text":109,"@type":110},"Use a regex literal enclosed in slashes, or use the constructor function new RegExp('pattern') when the pattern needs to change programmatically.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"What do \\w, \\W, \\d, \\D, \\s, and \\S match?",{"text":114,"@type":110},"\\w matches word characters (alphanumeric and underscore), \\W matches non-word characters. \\d matches digits (equivalent to [0-9]), \\D matches non-digits. \\s matches whitespace, while \\S matches non-whitespace.",{"name":116,"@type":107,"acceptedAnswer":117},"What is the difference between \\b and \\B in regex?",{"text":118,"@type":110},"\\b matches at the beginning or end of a word, while \\B matches only inside a word where a boundary is not present.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},571363,1792087027,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":50,"category_name":51,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":136,"language":137,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":138,"faqs":139,"seo_title":140,"seo_description":61,"update_tm":141,"read_time":47},3985747874027,"https://ap-avatar.wpscdn.com/davatar_9964176cb1d06d4a9deccf72a44ae3dc","JavaScript Regex Cheat Sheet [https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278](https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278)  \n􀀁  \n 􀀂  \nAdvertisement  \nCode › Regular Expressions  \nJavaScript Regex Cheat Sheet  \n Monty Shokeen Last updated Mar 23, 2022  \n􀀁 Read Time: 9 min | 􀀂 English   \nSuccessfully working with regular expressions requires you to know what each special character, flag, and method does. This is a regular expressions cheat sheet which you can refer to when trying to remember how a method, special character, or flag works.  \nCreating a Regular Expression in JavaScript  \nMethod Example Benefits  \nRegular Expression Literal Constructor Function  \n/^(\\d+)/  \nnew RegExp('^(\\d+)')  \nbetter performance  \ncan use variables  \n1 of 17 5/16/2023, 6:00 PM  \nJavaScript Regex Cheat Sheet [https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278](https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278)  \nMatching a Specific Set of Characters  \nany character  \n[abc]  any character listed  [^abc] any character not listed  \n\\w word characters  \\W non-word characters  \n\\d digits  \\D non-digits  \n\\s whitespace  \\S non-whitespace  \n\\b word boundaries  \\B non-word boundaries  \nOperator Matches Operator Matches  \nSpecifying the Number of Times to Match  \n\n| Symbol Meaning Symbol |  | Meaning |\n| --- | --- | --- |\n| \u003Cbr>^ | beginning of the line or string  $\u003Cbr>| end of the line or string |\n| \u003Cbr>*\u003Cbr>| zero or more repetitions  | one or more repetitions |\n| \u003Cbr>? | possibly exists |  |\n| {n}\u003Cbr>| specific number of repetitions  {n,m}\u003Cbr>| range of repetitions |\n| Using | Flags With Regular Expressions\u003Cbr>Meaning Flag | Meaning |\n| Flag |  |  |\n\ng global  \ni case-insensitive  \nm  \ny  \nmultiline mode  \nsticky search  \n2 of 17 5/16/2023, 6:00 PM  \nJavaScript Regex Cheat Sheet [https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278](https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278)  \nParenthesis in Regular Expressions  \nRegular Expression Methods in JavaScript  \nFunction Purpose  \ntest if a pattern matches find a matching pattern get matches  \nreplace matched text split on matches  \nCreating a Regular Expression in  \nJavaScript  \nThere are two ways of defining a regular expression in JavaScript.  \nRegular Expression Literal  \nvar rgx = /^(\\d+)/ : You can use a regular expression literal and enclose the pattern between slashes. This is evaluated at compile time and provides better  \nperformance if the regular expression stays constant.  \nConstructor Function  \n var rgx = new RegExp('^(\\d+)') : The constructor function is useful when the  \nregular expression may change programmatically. These are compiled during  \nruntime.  \n3 of 17 5/16/2023, 6:00 PM  \nJavaScript Regex Cheat Sheet [https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278](https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278)  \n[back]  \nMatching a Specific Set of Characters  \nThe following sequences can be used to match a specific set of characters.  \nAny Character   \nThe period matches any character except the newline '\\n' .  \nExpression  \n..  \nResult  \nno matches  \n1 match: ab  \n1 match: ab  \n2 matches: ab and cd  \nCustom Character Groups  [...]   \nThe square brackets are used to specify a collection of characters. [abc] would match the letter , b , or  . [a-z] would match any letter between  and z .  \nWith a  symbol, the square brackets match any character not listed. For example, [^0-9] matches any non-digit character.  \nExpression  \n[abc]  \nString  \na  \nResult  \nmatch: a  \n4 of 17 5/16/2023, 6:00 PM  \nJavaScript Regex Cheat Sheet [https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278](https://code.tutsplus.com/tutorials/a-simple-regex-cheat-sheet--cms-31278)  \nac  \nHello!  \nThe boy is  \nuser1234  \nhappy .  \nmatches:  a  and c no matches  \nmatches: b and   \nmatches: u , s , e , a","cbCaifFfH6oayVL3","https://ap.wps.com/l/cbCaifFfH6oayVL3","pdf",284132,13,"English","# JavaScript Regex Cheat Sheet\n## Creating a Regular Expression in JavaScript\n## Matching a Specific Set of Characters\n## Operator Symbols and Repetition Counts\n## Flags With Regular Expressions\n## Parenthesis and Core Methods\n## Character Class Shortcuts: \\w, \\d, \\s, \\b, ^ and $","[{\"question\":\"How do you define a regular expression in JavaScript?\",\"answer\":\"Use a regex literal enclosed in slashes, or use the constructor function new RegExp('pattern') when the pattern needs to change programmatically.\"},{\"question\":\"What do \\\\w, \\\\W, \\\\d, \\\\D, \\\\s, and \\\\S match?\",\"answer\":\"\\\\w matches word characters (alphanumeric and underscore), \\\\W matches non-word characters. \\\\d matches digits (equivalent to [0-9]), \\\\D matches non-digits. \\\\s matches whitespace, while \\\\S matches non-whitespace.\"},{\"question\":\"What is the difference between \\\\b and \\\\B in regex?\",\"answer\":\"\\\\b matches at the beginning or end of a word, while \\\\B matches only inside a word where a boundary is not present.\"}]","JavaScript Regex Cheat Sheet - Part 3 - Quick reference | PDF",1791914117]