Skip to content

Commit b5ae8d5

Browse files
authored
[RSDK-11561] Fix regex for module name validation (#5240)
1 parent 00f24eb commit b5ae8d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cli/module_generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func promptUser(module *modulegen.ModuleInputs) error {
284284
if s == "" {
285285
return errors.New("module name must not be empty")
286286
}
287-
match, err := regexp.MatchString("^[a-zA-Z]+(?:[_-][a-zA-Z0-9]+)*$", s)
287+
match, err := regexp.MatchString("^[a-zA-Z]+(?:[_-a-zA-Z0-9]+)*$", s)
288288
if !match || err != nil {
289289
return errors.New("module names can only contain alphanumeric characters, dashes, and underscores,\nand must start with a letter")
290290
}
@@ -329,7 +329,7 @@ func promptUser(module *modulegen.ModuleInputs) error {
329329
if s == "" {
330330
return errors.New("model name must not be empty")
331331
}
332-
match, err := regexp.MatchString("^[a-zA-Z]+(?:[_-][a-zA-Z0-9]+)*$", s)
332+
match, err := regexp.MatchString("^[a-zA-Z]+(?:[_-a-zA-Z0-9]+)*$", s)
333333
if !match || err != nil {
334334
return errors.New("model names can only contain alphanumeric characters, dashes, and underscores,\nand must start with a letter")
335335
}

0 commit comments

Comments
 (0)