Skip to content

Commit 2c48eff

Browse files
committed
Fix regex issue where certain characters weren't escaped correctly (would make it so certain commands won't register for users) and make alternate command actually work
1 parent f87c5f6 commit 2c48eff

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ This app is open source and licensed under the BSD 3-Clause License. You can fin
5858
NOTE: If you remove the app from your subreddit, it will delete all data and you will have to manually restore it to users.
5959

6060
## Version History
61-
### 26.0.1
62-
* Update mods when they are setting point commands to inform them that the command may only contain values found on a standard keyboard (32-126 (hex 20-7E))
63-
### 26.0.0
61+
### 26.1.0
6462
* Fix regex issue where certain characters weren't escaped correctly (would make it so certain commands won't register for users)
6563
* Make alternate command actually work
6664
### 25.2.0

src/blocks/triggers/utils/common-utilities.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export async function userCommandValues(context: TriggerContext) {
7070
export function escapeForRegex(string: string) {
7171
// String being replaced represents all symbols that
7272
// appear on the standard computer keyboard
73-
return string.replace(/[\x20-\x7E]{1,}/gi, "\\");
73+
const regex = /[\`\~\!\@\#\$\%\^\&\*\(\)\_\+\-\=\{\}\[\]\:\"\;\'\<\>\?\,\.\/\|\\a-z0-9\s]+/gi;
74+
return string.replace(regex, "\\");
7475
}
7576

7677
export async function getTriggers(context: TriggerContext) {

0 commit comments

Comments
 (0)