@@ -218,7 +218,7 @@ npm install
218218
219219 describe ( "command mention regex patterns" , ( ) => {
220220 it ( "should match valid command mention patterns anywhere" , ( ) => {
221- const commandRegex = / \/ ( [ a - z A - Z 0 - 9 _ \ .- ] + ) (? = \s | $ ) / g
221+ const commandRegex = / \/ ( [ a - z A - Z 0 - 9 _ . - ] + ) (? = \s | $ ) / g
222222
223223 const validPatterns = [ "/setup" , "/build-prod" , "/test_suite" , "/my-command" , "/command123" ]
224224
@@ -230,19 +230,19 @@ npm install
230230 } )
231231
232232 it ( "should match command patterns in middle of text" , ( ) => {
233- const commandRegex = / \/ ( [ a - z A - Z 0 - 9 _ \ .- ] + ) (? = \s | $ ) / g
233+ const commandRegex = / \/ ( [ a - z A - Z 0 - 9 _ . - ] + ) (? = \s | $ ) / g
234234
235235 const validPatterns = [ "Please /setup" , "Run /build now" , "Use /deploy here" ]
236236
237237 validPatterns . forEach ( ( pattern ) => {
238238 const match = pattern . match ( commandRegex )
239239 expect ( match ) . toBeTruthy ( )
240- expect ( match ! [ 0 ] ) . toMatch ( / ^ \/ [ a - z A - Z 0 - 9 _ \ .- ] + $ / )
240+ expect ( match ! [ 0 ] ) . toMatch ( / ^ \/ [ a - z A - Z 0 - 9 _ . - ] + $ / )
241241 } )
242242 } )
243243
244244 it ( "should match commands at start of new lines" , ( ) => {
245- const commandRegex = / \/ ( [ a - z A - Z 0 - 9 _ \ .- ] + ) (? = \s | $ ) / g
245+ const commandRegex = / \/ ( [ a - z A - Z 0 - 9 _ . - ] + ) (? = \s | $ ) / g
246246
247247 const multilineText = "First line\n/setup the project\nAnother line\n/deploy when ready"
248248 const matches = multilineText . match ( commandRegex )
@@ -255,7 +255,7 @@ npm install
255255 } )
256256
257257 it ( "should match multiple commands in message" , ( ) => {
258- const commandRegex = / (?: ^ | \s ) \/ ( [ a - z A - Z 0 - 9 _ \ .- ] + ) (? = \s | $ ) / g
258+ const commandRegex = / (?: ^ | \s ) \/ ( [ a - z A - Z 0 - 9 _ . - ] + ) (? = \s | $ ) / g
259259
260260 const validText = "/setup the project\nThen /deploy later"
261261 const matches = validText . match ( commandRegex )
@@ -267,7 +267,7 @@ npm install
267267 } )
268268
269269 it ( "should not match invalid command patterns" , ( ) => {
270- const commandRegex = / \/ ( [ a - z A - Z 0 - 9 _ \ .- ] + ) (? = \s | $ ) / g
270+ const commandRegex = / \/ ( [ a - z A - Z 0 - 9 _ . - ] + ) (? = \s | $ ) / g
271271
272272 const invalidPatterns = [ "/ space" , "/with space" , "/with/slash" , "//double" , "/with@symbol" ]
273273
0 commit comments