Skip to content

Commit 608f823

Browse files
authored
feat: add new regex alphaDashes to the list (#901)
* feat: add alphaDashes regex * feat: add alphaDashes regex * feat: add alphaDashes regex * feat: update pnpm lock * feat: remove test update on use-i18n * feat: remove test update on use-i18n * feat: remove test update on use-i18n
1 parent ad5f90f commit 608f823

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

packages/regex/src/__tests__/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
absoluteLinuxPath,
33
alpha,
4+
alphaDashes,
45
alphaLower,
56
alphanum,
67
alphanumLowercase,
@@ -137,6 +138,27 @@ describe('@regex', () => {
137138
})
138139
})
139140

141+
describe('alphaDashes', () => {
142+
test.each([
143+
[alphanumdashText, true],
144+
[alphanumdashdotsText, false],
145+
[asciiLetters, true],
146+
[asciiLowercase, true],
147+
[asciiUppercase, true],
148+
[digitsTest, false],
149+
[emailTest, false],
150+
[octdigits, false],
151+
[hexdigits, false],
152+
[printable, false],
153+
[punctuation, false],
154+
[whitespace, false],
155+
[cronTest, false],
156+
[macAddress1, false],
157+
])('should match regex %s to be %s', (string, expected) => {
158+
expect(alphaDashes.test(string)).toBe(expected)
159+
})
160+
})
161+
140162
describe('alphanumdash', () => {
141163
test.each([
142164
[alphanumdashText, true],

packages/regex/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const alpha = /^[a-zA-Z]*$/
22
export const alphaLower = /^[a-z]+$/
33
export const alphanum = /^[a-zA-Z0-9]*$/
4+
export const alphaDashes = /^[a-zA-Z-]*$/
45
export const alphanumdash = /^[a-zA-Z0-9-]*$/
56
export const alphanumdashdots = /^[a-zA-Z0-9-.]*$/
67
export const alphanumdashdotsorempty = /^$|^[a-zA-Z0-9-.]*$/

0 commit comments

Comments
 (0)