× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm using this in production right now...

(note the CAST function. Took me forever to figure that one.)

RtnVal = 1;
exec sql
SELECT
regexp_count(trim(cast(:emailaddr as CHAR(70) ccsid 37)),
'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')
into :RtnVal
from sysibm/sysdummy1;
if RtnVal=0;
W#ERFL=*ON;
W#MSDT='Valid email address must be entered.';
Endif;

Chris Wyatt
ERP Business Analyst
barrywehmiller
BUILDING A BETTER WORLD THROUGH BUSINESS

+1 (630) 759-6800 x 80163167
chris.wyatt@xxxxxxxxxxxxxxxxxxxxxx



-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Pete Helgren
Sent: Friday, December 4, 2020 9:58 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Does anyone know of an API to validate an email address?


[EXTERNAL E-MAIL]




And my experience is that it is devilishly difficult to get regex for email validation "just right" for all possible iterations of addresses....

Pete Helgren
https://urldefense.com/v3/__http://www.petesworkshop.com__;!!JWpd780U2qK2pF4!D7-_0p4tChsmvfVh4xFwnasrbZedhICYe8KR13n8xbNHy_PxFrC3J9gNc0xPwUcoNgsExlXTBw$
GIAC Secure Software Programmer-Java
AWS Certified Cloud Practitioner
Twitter - Sys_i_Geek IBM_i_Geek

On 12/4/2020 9:33 AM, David Gibbs via RPG400-L wrote:
On 12/4/20 9:21 AM, Timothy Feldmeier wrote:
I have a screen for the user to enter email addresses. Sometimes they
enter a typo. It would be nice to have an API, instead of writing
code for the validation of an email address.

Are you looking to check the format of the email or the validity of
the address?

There's a regex on my blog post about using REGEX in RPG
(https://urldefense.com/v3/__https://www.geekyramblings.net/2020/05/16
/regex-in-rpg/__;!!JWpd780U2qK2pF4!D7-_0p4tChsmvfVh4xFwnasrbZedhICYe8KR13n8xbNHy_PxFrC3J9gNc0xPwUcoNgu6wDmI7Q$ ) that is supposed to validate email addresses ... but I've never used it.

There are also web services available that are supposed to validate
email addresses.

david
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/rpg400-l__;!!JWpd780U2qK2pF4!D7-_0p4tChsmvfVh4xFwnasrbZedhICYe8KR13n8xbNHy_PxFrC3J9gNc0xPwUcoNguzSxI0pA$
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.com/v3/__https://archive.midrange.com/rpg400-l__;!!JWpd780U2qK2pF4!D7-_0p4tChsmvfVh4xFwnasrbZedhICYe8KR13n8xbNHy_PxFrC3J9gNc0xPwUcoNgtH2I1ymA$ .

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://urldefense.com/v3/__https://amazon.midrange.com__;!!JWpd780U2qK2pF4!D7-_0p4tChsmvfVh4xFwnasrbZedhICYe8KR13n8xbNHy_PxFrC3J9gNc0xPwUcoNgtu-iZ2ug$

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.