{"id":2338,"date":"2006-07-18T03:56:00","date_gmt":"2006-07-18T03:56:00","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/regular-expressions\/"},"modified":"2016-07-28T10:48:51","modified_gmt":"2016-07-28T10:48:51","slug":"regular-expressions","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/regular-expressions\/","title":{"rendered":"Regular Expressions"},"content":{"rendered":"<p>I have just spent the last hour or so&#160;trying to get a .NET&#8217;s regular expression to do what I want (matching&#160;a&#160;one of several possible&#160;keys followed by an = followed by&#160;a quoted string with possible escape chars in it &#8211; not difficult you would think).<\/p>\n<p>Unfortunately it seems every time you change platform or language you get bundled with yet another&#160;new&#160;regular expression syntax. Why is this necessary?&#160;As far as I can tell none of the syntax&#8217;s about make it any easier for the programmer to express what they want, they all have alternation, groups (ok we now have named groups), character classes, quantification, &#160;and replacement syntax.<\/p>\n<p>It seems those responsible for implementing regular expression support always seem to think they know better &#8211; why? We have enough dialects already PCRE, Posix and seemingly numerous Microsoft variations not to mention ANTLR, Lex and Yacc (and all their different implementations which have subtle bugs\/discrepencies).<\/p>\n<p>Why didnt microsoft do somthing senisble like allow us to build the FSA from an object model (which could be quite nicely done allowing for named librarys of known FSA&#8217;s) or choose a common syntax like PCRE or Posix rather than saying we will do roughly the same but <\/p>\n<p>Anyway enough of a rant and back to the regex&#8217;s..<\/p>\n<p>As a parting note if you are working with Regular Expressions quite often then <a href=\"http:\/\/www.oreilly.com\/catalog\/regex\/\"><strong>Mastering Regular Expressions <\/strong><\/a>(J. Friedl, Oreilly 1997) is a great book.. well at least&#160;if you are using Posix or PCRE..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have just spent the last hour or so&#160;trying to get a .NET&#8217;s regular expression to do what I want (matching&#160;a&#160;one of several possible&#160;keys followed by an = followed by&#160;a quoted string with possible escape chars in it &#8211; not difficult you would think). Unfortunately it seems every time you change platform or language you&#8230;&hellip;<\/p>\n","protected":false},"author":94441,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[],"class_list":["post-2338","post","type-post","status-publish","format-standard","hentry","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/94441"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=2338"}],"version-history":[{"count":2,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2338\/revisions"}],"predecessor-version":[{"id":41412,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2338\/revisions\/41412"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=2338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=2338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=2338"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=2338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}