Writing Regex Replacer

by Jakob Lien
5
4
3
2
1
Score: 50/100

Description

Replaces your text as you write, using configurable regexes.

Reviews

No reviews yet.

Stats

0
stars
54
downloads
0
forks
50
days
49
days
49
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
5
commits

Latest Version

2 months ago

Changelog

README file from

Github

Writing 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:
    1. Whether or not the match needs to have whitespace before it. In the Jira example above, this avoid matching ABCPROJ-123
    2. Whether or not to require a space after the regex before matching. In the Jira example above, this avoids matching and replacing PROJ-1 before you type the second two digits.
  • Javascript replace apparently doesn't support $0 to reference the entire match directly, so the plugin automatically replaces $0 with what javascript does support, $&.

The plugin only replaces as you type, and only on the current line.