Skip to content

Commit 7569e06

Browse files
fix: making sure that all possible matches of speical dummy codes are covered
1 parent a200ca9 commit 7569e06

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

application/CohortManager/src/Functions/Shared/Common/ValidationHelper.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@ public static bool ValidatePostcode(string postcode)
113113
public static (string? outcode, bool isDummyPostCode) ParseOutcode(string postcode)
114114
{
115115
string pattern = @"^([A-Za-z][A-Za-z]?[0-9][A-Za-z0-9]?) ?[0-9][A-Za-z]{2}$";
116-
string specialDummyOutCode = "ZZZSECUR";
116+
string specialDummyOutCodePattern = "^ZZ99|^ZZZSECUR$";
117117

118118
Match match = Regex.Match(postcode, pattern, RegexOptions.IgnoreCase, TimeSpan.FromSeconds(2));
119+
Match dummyOutCodePattern = Regex.Match(postcode, specialDummyOutCodePattern, RegexOptions.IgnoreCase, TimeSpan.FromSeconds(2));
119120

120-
if (postcode == specialDummyOutCode)
121+
if (dummyOutCodePattern.Success)
121122
{
122123
return (postcode, true);
123124
}

0 commit comments

Comments
 (0)