{"id":3426,"date":"2024-10-01T15:33:56","date_gmt":"2024-10-01T14:33:56","guid":{"rendered":"https:\/\/desairem.com\/wordpress\/?p=3426"},"modified":"2025-08-21T11:00:53","modified_gmt":"2025-08-21T10:00:53","slug":"patchword-edit-script","status":"publish","type":"post","link":"https:\/\/desairem.com\/wordpress\/patchword-edit-script\/","title":{"rendered":"Edit script"},"content":{"rendered":"\n<p>An edit script contains a list of find and replace operations that, when applied to an original file, produce a modified file.<\/p>\n\n\n\n<p>Since an edit script doesn&#8217;t modify the original file directly but allows you to export the result, there&#8217;s no risk of replacing many occurrences only to find out later that some replacements didn&#8217;t work as intended: you can just correct the edit script and apply it again to the original file.<\/p>\n\n\n\n<p>If you need to replace text in multiple files, just apply the edit script to each file instead of manually repeating the same operations manually in a text editor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Rules<\/h2>\n\n\n\n<p>An edit script consists of a set of rules that are applied sequentially. Each rule finds some text and replaces it with some other text.<\/p>\n\n\n\n<p>The <strong>mode<\/strong> of each rule can be set to one of the following values:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Text<\/strong>: the find and replace values are treated as plain text.<\/li>\n\n\n\n<li><strong>Regular Expression<\/strong>: use <a href=\"https:\/\/en.wikipedia.org\/wiki\/Regular_expression\">regular expressions<\/a> to match text patterns that cannot be expressed with plain text. For example, they allow to match numbers or entire words.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Format<\/h2>\n\n\n\n<p>An edit script is a JSON file with the following structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"rules\" : &#91;\n    {\n      \"find\" : \"apple\",\n      \"findMode\" : \"text\",\n      \"replace\" : \"banana\"\n    }\n  ]\n}<\/code><\/pre>\n\n\n\n<p><code>findMode<\/code> can be <code>text<\/code> or <code>regularExpression<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An edit script contains a list of find and replace operations that, when applied to an original file, produce a modified file. Since an edit script doesn&#8217;t modify the original file directly but allows you to export the result, there&#8217;s no risk of replacing many occurrences only to find out later that some replacements didn&#8217;t [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"wp-custom-template-patchword-help-topic","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[],"class_list":["post-3426","post","type-post","status-publish","format-standard","hentry","category-patchword-help"],"_links":{"self":[{"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/posts\/3426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3426"}],"version-history":[{"count":2,"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/posts\/3426\/revisions"}],"predecessor-version":[{"id":4939,"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/posts\/3426\/revisions\/4939"}],"wp:attachment":[{"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/desairem.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}