From 33241d37ea3a4d3ed3cfbb01010a3c70cad494d0 Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Mon, 8 Apr 2024 12:33:28 -0700 Subject: [PATCH] Madhur/improve regex (#192) * add more chars * add more chars --- types/operator_metadata_test.go | 2 +- utils/utils.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/operator_metadata_test.go b/types/operator_metadata_test.go index 569e1fa0..5d0eb716 100644 --- a/types/operator_metadata_test.go +++ b/types/operator_metadata_test.go @@ -17,7 +17,7 @@ func TestOperatorMetadata(t *testing.T) { name: "Valid metadata with twitter.com url", metadata: OperatorMetadata{ Name: "Ethereum Utopia", - Description: "Madhur's first operator is best in this world", + Description: "Madhur's first operator is best in this world+&~#", Logo: "https://goerli-operator-metadata.s3.amazonaws.com/eigenlayer.png", Twitter: "https://twitter.com/test", Website: "https://test.com", diff --git a/utils/utils.go b/utils/utils.go index 51b4b910..540dd950 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -228,7 +228,7 @@ func ValidateText(text string) error { } // Regular expression to validate text - textPattern := regexp.MustCompile(`^[a-zA-Z0-9 +.,;:?!'"\-_/()\[\]]+$`) + textPattern := regexp.MustCompile(`^[a-zA-Z0-9 +.,;:?!'"\-_/()\[\]~&#]+$`) // Check if the URL matches the regular expression if !textPattern.MatchString(text) {