{"_id":"58c10f5a2c3c720f00768b98","__v":0,"parentDoc":null,"user":"573592b84b0ab120000b7d44","category":{"_id":"58c10f5a2c3c720f00768b8e","__v":0,"version":"58c10f5a2c3c720f00768b87","project":"5735936aafab441700723a50","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-20T15:04:12.866Z","from_sync":false,"order":9,"slug":"additional-documentation","title":"Additional documentation"},"githubsync":"","project":"5735936aafab441700723a50","version":{"_id":"58c10f5a2c3c720f00768b87","project":"5735936aafab441700723a50","__v":4,"createdAt":"2017-03-09T08:16:26.385Z","releaseDate":"2017-03-09T08:16:26.385Z","categories":["58c10f5a2c3c720f00768b88","58c10f5a2c3c720f00768b89","58c10f5a2c3c720f00768b8a","58c10f5a2c3c720f00768b8b","58c10f5a2c3c720f00768b8c","58c10f5a2c3c720f00768b8d","58c10f5a2c3c720f00768b8e","58c10f5a2c3c720f00768b8f","58c10f5a2c3c720f00768b90","58c10f5a2c3c720f00768b91","58c10f5a2c3c720f00768b92","58c10f5a2c3c720f00768b93","58c11574b36d8c0f006fda47","58c2cdcafc6eed3900e97640","58c2ce8afc6eed3900e97663"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-16T10:35:33.340Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"When extracting identifiers, synonyms and descriptions from files, it is often necessary to use only a specific portion of an existing string and possibly modify it to maintain compatibility with other files.  The match and replace pattern used extensively in the Stage 2 configuration files is intended to simplify this process and to remove the need to use one-liners to generate intermediate files with compatible naming.\n\nThe pattern used is to match a regular expression within the selected string and optionally replace part of this string using a second regular expression.\n\n## Match\n\nThe simplest case is to match the entire string:\n\n```\n/(.+)/\n```\n\nTo match part of a string, either specify the pattern to match inside the parentheses, or specify a sting to exclude outside the parentheses:\n```\n/(\\w+\\d+)/\n/(.+)-PA/\n```\n\n## Replace\n\nIf specified, a second regular expression acts on the value captured during the match step and substitutes one of more characters:\n\n```\n/(.+)/ /-PA/-TA/\n```","excerpt":"","slug":"match-and-replace","type":"basic","title":"Match and replace"}
When extracting identifiers, synonyms and descriptions from files, it is often necessary to use only a specific portion of an existing string and possibly modify it to maintain compatibility with other files. The match and replace pattern used extensively in the Stage 2 configuration files is intended to simplify this process and to remove the need to use one-liners to generate intermediate files with compatible naming. The pattern used is to match a regular expression within the selected string and optionally replace part of this string using a second regular expression. ## Match The simplest case is to match the entire string: ``` /(.+)/ ``` To match part of a string, either specify the pattern to match inside the parentheses, or specify a sting to exclude outside the parentheses: ``` /(\w+\d+)/ /(.+)-PA/ ``` ## Replace If specified, a second regular expression acts on the value captured during the match step and substitutes one of more characters: ``` /(.+)/ /-PA/-TA/ ```