Highlighted

JavaScript RegEx validation: how to highlight what didn't match

LEGEND ,
May 14, 2020

Copy link to clipboard

Copied

Hello, all,

 

I'm in the process of writing something to add to an existing project.  The ability for a user to include up to five email addresses to CC an attachment to said addresses.  I've got the validation working as I want it.  Now, just for giggles, I'd like to have the ability to highlight what part of a malformed email address didn't match the email mask.

 

I've seen examples where, in a string search, the entered word would be highlighted in other words.  For example:  A list of words like, "car", "escape", "abracadabra", and someone enters "ca", then it would appear like:

car

escape

abracadabra

 

But I wonder if RegEx can be used to highlight what failed validation of an email address?

 

V/r,

 

^ _ ^

Topics

Bootstrap, Browser, Code, Download install and licensing, Error, Extensions, How to, Import and export, Interface, Other, Performance, Preview, Product issue, Publish, Server side applications

Views

886

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

JavaScript RegEx validation: how to highlight what didn't match

LEGEND ,
May 14, 2020

Copy link to clipboard

Copied

Hello, all,

 

I'm in the process of writing something to add to an existing project.  The ability for a user to include up to five email addresses to CC an attachment to said addresses.  I've got the validation working as I want it.  Now, just for giggles, I'd like to have the ability to highlight what part of a malformed email address didn't match the email mask.

 

I've seen examples where, in a string search, the entered word would be highlighted in other words.  For example:  A list of words like, "car", "escape", "abracadabra", and someone enters "ca", then it would appear like:

car

escape

abracadabra

 

But I wonder if RegEx can be used to highlight what failed validation of an email address?

 

V/r,

 

^ _ ^

Topics

Bootstrap, Browser, Code, Download install and licensing, Error, Extensions, How to, Import and export, Interface, Other, Performance, Preview, Product issue, Publish, Server side applications

Views

887

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
May 14, 2020

Copy link to clipboard

Copied

Failed e-mail syntax patterns are mostly caused by typos.  For example, a missing @ sign or 2 dots before the TLD.  In some cases, an unrecognized TLD (.com.tv).   I don't know how you would express that in a meaningful way with RegEx, sorry.

 

Nancy O'Shea, ACP
Alt-Web.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
May 15, 2020

Copy link to clipboard

Copied

Hi, Nancy,

 

I'm just assuming that it can be done.. mostly because 99% of RegEx is unknown to me, and I know a lot more can be done with it than I could ever dream.  I will try to reverse-engineer the string search examples and see if I can somehow get a highlight on what failed, but I'm not very hopeful.  🙂

 

V/r,

 

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
Learn Resources
Add a group