From 21a0c48fc6b8be71073212c693b4bd70ac1c7226 Mon Sep 17 00:00:00 2001 From: ldsands Date: Sat, 2 May 2020 15:56:36 -0500 Subject: [PATCH] 0.0.4 0.0.4 - 2020-05-02 Patch - Changed - changed all of the regular expressions and placed them directly into the string replace `searchValue` section - Fixed - fixed the issue of the rmNewLines working correctly - fixed the issue of the rmSentenceBreaks working correctly --- CHANGELOG.md | 10 ++++++++++ README.md | 20 ++++++++++++++++++++ src/extension.ts | 12 ++++-------- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b43b3f..eb9a067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ All notable changes to the "PasteRegEx" extension will be documented in this fil +## 0.0.4 - 2020-05-02 + +Patch + +- Changed + - changed all of the regular expressions and placed them directly into the string replace `searchValue` section +- Fixed + - fixed the issue of the rmNewLines working correctly + - fixed the issue of the rmSentenceBreaks working correctly + ## 0.0.3 - 2020-04-29 Patch diff --git a/README.md b/README.md index a8e030c..3fd1dfb 100644 --- a/README.md +++ b/README.md @@ -73,3 +73,23 @@ These plans are very much a wishlist that may or may not ever be completed. Feel ## Release Notes [see the changelog](CHANGELOG.md) + + diff --git a/src/extension.ts b/src/extension.ts index 16d3258..8fb0263 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -37,8 +37,7 @@ export function activate(context: vscode.ExtensionContext) { */ var selectionText: String = getSelectedText(); let editor = vscode.window.activeTextEditor; - const RegEx = new RegExp(" +$", "gm") - var modifiedString: string = selectionText.replace(RegEx, ""); + var modifiedString: string = selectionText.replace(/ +$/gm, ""); insertNewString(modifiedString) }); @@ -48,8 +47,7 @@ export function activate(context: vscode.ExtensionContext) { */ var selectionText: String = getSelectedText(); let editor = vscode.window.activeTextEditor; - const RegEx = new RegExp("\r?|\n?", "gm") - var modifiedString: string = selectionText.replace(RegEx, " "); + var modifiedString: string = selectionText.replace(/\r\n+|\n+|\r+/gm, " "); insertNewString(modifiedString) }); @@ -59,8 +57,7 @@ export function activate(context: vscode.ExtensionContext) { */ var selectionText: String = getSelectedText(); let editor = vscode.window.activeTextEditor; - const RegEx = new RegExp("(?<=[a-z])-$\r?|\n?(?=[a-z])", "gm") - var modifiedString: string = selectionText.replace(RegEx, ""); + var modifiedString: string = selectionText.replace(/(?<=[a-z])-$\r\n+|\n+|\r+(?=[a-z])/gm, ""); insertNewString(modifiedString) }); @@ -70,8 +67,7 @@ export function activate(context: vscode.ExtensionContext) { */ var selectionText: String = getSelectedText(); let editor = vscode.window.activeTextEditor; - const RegEx = new RegExp("(?<=[a-z])$\r?|\n?(?=[a-z])", "gm") - var modifiedString: string = selectionText.replace(RegEx, " "); + var modifiedString: string = selectionText.replace(/([a-z])(\r\n+|\n+|\r+)(?=[a-z])/gm, "$1 "); insertNewString(modifiedString) }); }