forked from egovernments/health-campaign-services
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HCMPRE-218 adding validation for plan config name (egovernments#844)
* HCMPRE-218 adding validation for name validation * HCMPRE-218 adding validation for name validation * HCMPRE-218 moving "$." into constants * HCMPRE-218 code review comments --------- Co-authored-by: kavi_elrey@1993 <[email protected]>
- Loading branch information
1 parent
f99475a
commit 1ed7c59
Showing
5 changed files
with
93 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
health-services/plan-service/src/main/java/digit/util/ServiceUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package digit.util; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
@Component | ||
public class ServiceUtil { | ||
|
||
/** | ||
* Validates the given input string against the provided regex pattern. | ||
* | ||
* @param patternString the regex pattern to validate against | ||
* @param inputString the input string to be validated | ||
* @return true if the input string matches the regex pattern, false otherwise | ||
*/ | ||
public Boolean validateStringAgainstRegex(String patternString, String inputString) { | ||
Pattern pattern = Pattern.compile(patternString); | ||
Matcher matcher = pattern.matcher(inputString); | ||
return matcher.matches(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters