[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571360-105":53,"doc-detail-571360-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","cheat-sheet-regular-expressions-basics-reference","Cheat Sheet - Regular Expressions Basics - Reference","","Cheat sheet compiling common regular expression character classes, anchors, quantifiers, and lookaround constructs alongside practical examples. Includes patterns for digits/non-digits, lower/upper/alphabetic, alphanumeric, word characters, hex digits, whitespace, punctuation, and control characters. Covers newline and common escape sequences, plus lookahead/lookbehind and conditional if-then/if-then-else syntax. Provides R usage for grep, grepl, regexpr/gregexpr, regmatches, str_detect/str_locate/str_extract, extraction helpers, and string replacement with sub/gsub and stringr equivalents.",{"@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":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/cheat-sheet-regular-expressions-basics-reference/571360/",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/cheat-sheet-regular-expressions-basics-reference/571360.png","ImageObject",442,249,{"name":88,"@type":89},"aboduw","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-22","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",7,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"What do \\d, \\D, and [a-z] mean in regular expressions?","Question",{"text":109,"@type":110},"\\d matches digits (0-9) and \\D matches non-digits. [a-z] specifies a range of permitted lowercase letters.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"Which functions are used in R to find matches and their positions?",{"text":114,"@type":110},"Use grep/grepl for matching, regexpr for the first match, gregexpr for all matches, and stringr::str_locate/str_locate_all to get start/end positions.",{"name":116,"@type":107,"acceptedAnswer":117},"How can lookahead and lookbehind be expressed in patterns?",{"text":118,"@type":110},"Lookahead is written as (?=pattern) and negative lookahead as (?!pattern). Lookbehind uses (?\u003C=pattern) and negative lookbehind uses (?\u003C!pattern), with PERL=true noted as required in the cheat sheet context.","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},571360,1792019100,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":8,"category_name":11,"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":9,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":140,"read_time":4},3985747862266,"https://ap-avatar.wpscdn.com/davatar_085a072bc5b1113ac321206ff7593b45","Cheat Sheet  \n| [[:digit:]] or \\\\d | Digits; [0-9] |\n| --- | --- |\n| \\\\D | Non-digits; [^0-9] |\n| [[:lower:]] | Lower-case letters; [a-z] |\n| [[:upper:]] | Upper-case letters; [A-Z] |\n| [[:alpha:]] | Alphabetic characters; [A-z] |\n| [[:alnum:]] | Alphanumeric characters [A-z0-9] |\n| \\\\w | Word characters; [A-z0-9_ ] |\n| \\\\W | Non-word characters |\n| [[:xdigit:]] or \\\\x | Hexadec. digits; [0-9A-Fa-f] |\n| [[:blank:]] | Space and tab |\n| [[:space:]] or \\\\s | Space, tab, vertical tab, newline, form feed, carriage return |\n| \\\\S | Not space; [^[:space:]] |\n| [[:punct:]] | Punctuation characters;\u003Cbr>!\"\\#$%&’()*+,-./:;\u003C=>?@[]^_`{| }~ |\n| [[:graph:]] | Graphical characters;[[:alnum:][:punct:]] |\n| [[:print:]] | Printable characters;[[:alnum:][:punct:]\\\\s] |\n| [[:cntrl:]] or \\\\c | Control characters; \\n, \\r etc. |\n\n| \\n | New line |\n| --- | --- |\n| \\r | Carriage return |\n| \\t | Tab |\n| \\v | Vertical tab |\n| \\f | Form feed |\n\n| (?=) | Lookahead (requires PERL = TRUE), e.g. (?=yx): position followed by 'xy' |\n| --- | --- |\n| (?!) | Negative lookahead (PERL = TRUE); position NOT followed by pattern |\n| (?\u003C=) | Lookbehind (PERL = TRUE), e.g.(?\u003C=yx): position following 'xy' |\n| (?\u003C!) | Negative lookbehind (PERL = TRUE); position NOT following pattern |\n| ?(if)then | If-then-condition (PERL = TRUE); use lookaheads , optional char. etc in if-clause |\n| ?(if)then|else | If-then-else-condition (PERL = TRUE) |\n\n*see, e.g. [http://www.regular-expressions.info/lookaround.html](http://www.regular-expressions.info/lookaround.html)[ ](http://www.regular-expressions.info/lookaround.html)[http://www.regular-expressions.info/conditional.html](http://www.regular-expressions.info/conditional.html)  \n> string \u003C - c(\"Hiphopopotamus\", \"Rhymenoceros\", \"time for bottomless lyrics\")> pattern \u003C - \"t.m \"  \ngrep(pattern, string)  \n[1] 1 3  \ngrep(pattern, string, value = TRUE)  \n[1] \"Hiphopopotamus\"  \n[2] \"time for bottomless lyrics“  \ngrepl(pattern, string)  \n[1] TRUE FALSE TRUE  \nstringr::str_detect(string, pattern)  \n[1] TRUE FALSE TRUE  \nregexpr(pattern, string)  \nfind starting position and length of first match  \ngregexpr(pattern, string)  \nfind starting position and length of all matches stringr::str_locate(string, pattern)  \nfind starting and end position of first match stringr::str_locate_all(string, pattern)  \nfind starting and end position of all matches  \nstrsplit(string, pattern) or stringr::str_split(string, pattern)  \nregmatches(string, regexpr(pattern, string))  \nextract first match [1] \"tam\" \"tim\"  \nregmatches(string, gregexpr(pattern, string))  \nextract all matches, outputs a list  \n[[1]] \"tam\" [[2]] character(0) [[3]] \"tim\" \"tom\"stringr::str_extract(string, pattern)  \nextract first match [1] \"tam\" NA \"tim\"  \nstringr::str_extract_all(string, pattern) extract all matches, outputs a list  \nstringr::str_extract_all(string, pattern, simplify = TRUE)  \nextract all matches, outputs a matrix stringr::str_match(string, pattern)  \nextract first match + individual character groups stringr::str_match_all(string, pattern)  \nextract all matches + individual character groups  \nsub(pattern, replacement, string)  \nreplace first match  \ngsub(pattern, replacement, string)  \nreplace all matches  \nstringr::str_replace(string, pattern, replacement) replace first match  \nstringr::str_replace_all(string, pattern, replacement) replace all matches  \n| . | Any character except \\n |\n| --- | --- |\n| | | Or, e.g. (a|b) |\n| [   ] | List permitted characters, e.g. [abc] |\n| [a-z] | Specify character ranges |\n| [^   ] | List excluded characters |\n| (   ) | Grouping, enables back referencing using \\\\N where N is an integer |\n\n| ^ | Start of the string |\n| --- | --- |\n| $ | End of the string |\n| \\\\b | Empty string at either edge of a word |\n| \\\\B | NOT the edge of a word |\n| \\\\\u003C | Beginning of a word |\n| \\\\> | End of a word |\n\n| * | Matches at least 0 times |\n| --- | --- |\n| + | Matches at least 1 time |\n| ? | Matches at most 1 time; optional string |\n| {n} | Matches exactly n time","cbCaimql5Od11pcW","https://ap.wps.com/l/cbCaimql5Od11pcW","pdf",459566,"English","# Regular Expression Character Classes\n# Newlines, Anchors, and Quantifiers\n# Lookarounds and Conditional Patterns\n# R and stringr Functions for Matching and Extraction\n## Matching and Locating\n## Extraction\n## Substitution and Replacement","[{\"question\":\"What do \\\\d, \\\\D, and [a-z] mean in regular expressions?\",\"answer\":\"\\\\d matches digits (0-9) and \\\\D matches non-digits. [a-z] specifies a range of permitted lowercase letters.\"},{\"question\":\"Which functions are used in R to find matches and their positions?\",\"answer\":\"Use grep/grepl for matching, regexpr for the first match, gregexpr for all matches, and stringr::str_locate/str_locate_all to get start/end positions.\"},{\"question\":\"How can lookahead and lookbehind be expressed in patterns?\",\"answer\":\"Lookahead is written as (?=pattern) and negative lookahead as (?!pattern). Lookbehind uses (?\\u003c=pattern) and negative lookbehind uses (?\\u003c!pattern), with PERL=true noted as required in the cheat sheet context.\"}]","Cheat Sheet - Regular Expressions Basics - Reference | PDF",1791914106]