Skip to content

Commit

Permalink
Merge pull request #1275 from SanjalKatiyar/input_name_unresponsive
Browse files Browse the repository at this point in the history
fix 'catastrophic backtracking' issue with text-input regex
  • Loading branch information
openshift-merge-bot[bot] authored Apr 15, 2024
2 parents 8f48e18 + 11ae522 commit a464777
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/shared/src/utils/validation.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/**
* Starts and ends with a lowercase letter or number
*/
export const startAndEndsWithAlphanumerics =
/^(?![\W])([a-z0-9]|[\W]*([a-z0-9]))+(?![\W])$/;
export const startAndEndsWithAlphanumerics = /^[a-z0-9](.*[a-z0-9])?$/;

/**
* Only lowercase letters, numbers, non-consecutive periods, or hyphens
*/
export const alphaNumericsPeriodsHyphensNonConsecutive =
/^[a-z0-9]+([a-z0-9]|([-.](?![-.])))*[a-z0-9]*$/;
/(^[a-z0-9]|^([-.](?![-.])))+([a-z0-9]|([-.](?![-.])))*[a-z0-9]*$/;

export default {
startAndEndsWithAlphanumerics,
Expand Down

0 comments on commit a464777

Please sign in to comment.