{"_id":"5739a2751f4b740e00b06d91","__v":1,"project":"5735936aafab441700723a50","category":{"_id":"573f276c7eeb8b190094ca7d","__v":0,"version":"5735936aafab441700723a53","project":"5735936aafab441700723a50","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-20T15:04:12.866Z","from_sync":false,"order":6,"slug":"additional-documentation","title":"Additional documentation"},"user":"573592b84b0ab120000b7d44","version":{"_id":"5735936aafab441700723a53","__v":12,"project":"5735936aafab441700723a50","createdAt":"2016-05-13T08:42:18.615Z","releaseDate":"2016-05-13T08:42:18.615Z","categories":["5735936aafab441700723a54","5735a32931a73b1700887c94","5735b55beceb872200abbc6c","5735b56eb667601700d3bd6f","5735b9ba4b0ab120000b7dd4","5735b9c94b0ab120000b7dd5","5735cb131f16241700c8a0f7","5735e5c4e4824c3400aa1f21","5735e5d9e4824c3400aa1f23","5735e5f2ec67f6290013ac72","573ecfe0804f901700a9dfc7","573f276c7eeb8b190094ca7d"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"","version_clean":"1.0.0","version":"1.0"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-16T10:35:33.340Z","link_external":false,"link_url":"","githubsync":"","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/ ```