{"id":2394,"date":"2010-07-01T23:57:00","date_gmt":"2010-07-01T23:57:00","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/Hayek\/Jochen\/wp\/blog-en\/2010\/07\/01\/ruby-gsub-and-backslash-characters-within-the-replacement\/"},"modified":"2010-07-01T23:57:00","modified_gmt":"2010-07-01T23:57:00","slug":"ruby-gsub-and-backslash-characters-within-the-replacement","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2010\/07\/01\/ruby-gsub-and-backslash-characters-within-the-replacement\/","title":{"rendered":"ruby, gsub, and backslash characters within the replacement"},"content":{"rendered":"<p>\t\t\t\tMy ruby problem of the day: I have e-mail addresses, and I want to use them within procmail rules. Therefore certain characters like the dot character and also the &#8220;+&#8221;\u00a0 need escaping.<\/p>\n<p>It took me an endless while, like certain things always take an endless while on unknown grounds.<\/p>\n<p>I started with single quotes just as in the gsub examples in the pickaxe3 book. <\/p>\n<p>I didn&#8217;t get the right number of backslashs in place within the replacement string, as long as the replacement string used single quotes.<\/p>\n<p>Finally a Google search for &#8220;<i>ruby gsub replacement backslash<\/i>&#8221; led me to a solution. Not to an overly serious one, to be honest.<\/p>\n<p>The example there used double quotes, so I replaced my single quotes with double quotes, and I started again increasing the number of accumulated backslash characters. That way I achieved within a pretty short time, what I needed to achieve. Not that I had learned <b>too<\/b> much.\t\t\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My ruby problem of the day: I have e-mail addresses, and I want to use them within procmail rules. Therefore certain characters like the dot character and also the &#8220;+&#8221;\u00a0 need escaping. It took me an endless while, like certain things always take an endless while on unknown grounds. I started with single quotes just [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[666],"tags":[],"class_list":["post-2394","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-CC","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/2394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=2394"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/2394\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=2394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=2394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=2394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}