README file from
GithubWriting Regex Replacer
Replaces your text as you write, using configurable regexes.
An obvious use case for this is to expand for example a Jira issue into a link to that issue. The regex need to replace PROJ-123 with [PROJ-123](https://organisation.atlassian.net/browse/PROJ-123) is just:
- source:
PROJ-\d+ - target:
[$0](https://organisation.atlassian.net/browse/$0)
The actual matching and replacing is done using Javascripts replace method on your current line, but a few convenience features are added to make it easier to use.
- For each pattern (the set of source and target regex), there are two toggles, both of which have tooltips on them:
- Whether or not the match needs to have whitespace before it. In the Jira example above, this avoid matching
ABCPROJ-123 - Whether or not to require a space after the regex before matching. In the Jira example above, this avoids matching and replacing
PROJ-1before you type the second two digits.
- Whether or not the match needs to have whitespace before it. In the Jira example above, this avoid matching
- Javascript replace apparently doesn't support
$0to reference the entire match directly, so the plugin automatically replaces$0with what javascript does support,$&.
The plugin only replaces as you type, and only on the current line.