Text editing guides

Rename status labels with ordered find-and-replace rules

·

An export uses the legacy status Draft, but a downstream importer expects queued and a three-digit ID. Make both edits in one run. Compare the per-rule counts to catch changes to words such as Drafting and lines that still need manual review.

Find and Replace Text

Change the status without touching Drafting

Paste these three lines in Original text: Draft 103, Drafting 104 and draft 209. Put each on its own line. In Rule 1, find Draft, replace it with queued and enable Whole word only. Leave Match case cleared.

Select Apply rules. Expect two matches and two replacements. The first and third lines become queued 103 and queued 209. The middle line stays Drafting 104. Clear Whole word only and apply again to see a third match within the middle line.

ECMAScript: replacement substitutions

Use a capture group to keep the ID

Turn Whole word only back on for Rule 1. Add a rule, enable Use JavaScript regex and enter ^queued (\d{3})$ in Find. Set Replace with to job-$1: queued. Rule 2 sees the output of Rule 1, so its two matches produce job-103: queued and job-209: queued. The anchors refer to the start and end of each line.

Move the second rule up and apply again. It sees the original Draft lines and reports zero matches. Restore the order before downloading. Open replaced-text.txt in an editor to check the three lines and confirm that Drafting 104 is unchanged.

ECMAScript: replacement substitutions

Read the counts before reusing the output

Clear Replace all matches on the first rule to test the edit on one line. It reports two matches and one replacement. The regex rule now sees only one queued line.

If you want a fresh pass against the original file, leave Original text as it is. Choose Use as input only when the edited text should become the starting point for another pass.

Common questions

Do I type forward slashes around a pattern?

Enter the pattern by itself. The workspace applies JavaScript Unicode and multiline matching automatically. Use Match case to control case sensitivity.

How do I insert a literal dollar sign in a regex replacement?

Use $$ to insert one dollar sign in regex mode. With regex mode cleared, replacement text is inserted exactly as typed.

Sources

Put it into practice.

Related guides