-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajustes e novas funcionalidades para formulário pacientes
- Loading branch information
1 parent
8b5370e
commit d4fd3af
Showing
16 changed files
with
362 additions
and
353 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
Empty file.
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,35 @@ | ||
import re | ||
|
||
|
||
class CommonsUtil: | ||
|
||
ALPHA_PATTERN = "[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ\\-_\\s]+$" | ||
|
||
ALPHA_NUMERIC_PATTERN = "[A-Za-z0-9.-_]+$" | ||
|
||
ALPHA_NUMERIC_CHARACTER_PATTERN = "[A-Za-z0-9_À-ÿ.-_\\s]+$" | ||
|
||
NUMERIC_PATTERN = "[0-9]+$" | ||
|
||
PHONE_NUMERIC_PATTERN = "([0-9]{2})?([0-9]{2})([0-9]{4,5})([0-9]{4})" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def remove_characters(self, text: str) -> str: | ||
return re.sub("[^0-9]", "", text) | ||
|
||
def find_numbers(self, text: str): | ||
return re.findall(r"[0-9]+", text) | ||
|
||
def is_alpha_pattern(self, text: str): | ||
return re.match(self.ALPHA_PATTERN, text) | ||
|
||
def is_numeric_pattern(self, text: str): | ||
return re.match(self.NUMERIC_PATTERN, text) | ||
|
||
def is_alpha_numeric_character_pattern(self, text: str): | ||
return re.match(self.ALPHA_NUMERIC_CHARACTER_PATTERN, text) | ||
|
||
def is_phone_pattern(self, text: str): | ||
return re.match(self.PHONE_NUMERIC_PATTERN, text) |
Oops, something went wrong.