commit 2d61d5aa3e508666f9c29acd712fbe9cda2c9938
parent 37f038e72e8774412d6fcd6837f97af9d93575eb
Author: Sebastian <sebasjm@taler-systems.com>
Date: Tue, 21 Jul 2026 18:06:41 -0300
better email and phone regex
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/packages/challenger-webui/src/pages/AskChallenge.tsx b/packages/challenger-webui/src/pages/AskChallenge.tsx
@@ -121,7 +121,7 @@ export function AskChallenge(props: Props): VNode {
}
}
}
- return <AskChallengeInternal {...props} lastStatus={result.body}/>
+ return <AskChallengeInternal {...props} lastStatus={result.body} />;
}
function AskChallengeInternal({
@@ -130,7 +130,7 @@ function AskChallengeInternal({
session,
focus,
lastStatus,
-}: Props & {lastStatus: ChallengerApi.ChallengeStatus}): VNode {
+}: Props & { lastStatus: ChallengerApi.ChallengeStatus }): VNode {
const { sent, completed } = useSessionState();
const { lib, config } = useChallengerApiContext();
@@ -337,9 +337,15 @@ const ADDRESS_EXAMPLE_CH = `Street name 1
12345 City_name
country_name `;
-export const EMAIL_REGEX = /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/;
-export const PHONE_REGEX =
+export const EMAIL_REGEX =
+ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
+export const INT_PHONE_REGEX = /^\+?\d{1,3}\d{6,14}$/; // E.164 International Phone Number
+export const US_PHONE_REGEX =
/^(\+\d{1,2}\s?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/;
+export const AR_PHONE_REGEX =
+ /^(?:(?:00|\+)?549?)?\s?(?:[23]\d{2})?\s?(?:\d{4}[-.\s]?\d{4})$/;
+export const PHONE_REGEX = INT_PHONE_REGEX;
+
export const CONTACT_REGEX = /.*/;
export const ZIPCODE_REGEX = /.*/;
export const ADDR_LINES_REGEX = /.*/;