Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] email fieldtype, checking for more than one email address with Regex

  • mrartist
  • mrartist
  • OFFLINE
  • Posts: 51
  • Thanks: 9
  • Karma: 1
11 years 6 months ago - 11 years 3 months ago #225135 by mrartist
Hi
A while ago you showed me how to verify an email address in the email fieldtype, and it worked really well as follows:

Edit the email field in CB > Field Management and set "Authorized input:" to "Custom PERL regular expression" then set "Perl Regular Expression:" to "/^\w+@someuniversity.ac.uk$/" (without quotes). This will ensure the user can only register with an email address ending in @someuniversity.ac.uk.


Could you show me how I would add to that expression a second (or third) email address to verify against? e.g. @some-other-email.com
Last edit: 11 years 3 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48465
  • Thanks: 8280
  • Karma: 1443
11 years 6 months ago #225215 by krileon
Separate multiple values with | it's basically the OR usage for REGEX. Example as follows.

/^\w+@(someuniversity.ac.uk|some-other-email.com)$/"


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: nant

Please Log in or Create an account to join the conversation.

  • mrartist
  • mrartist
  • OFFLINE
  • Posts: 51
  • Thanks: 9
  • Karma: 1
11 years 6 months ago #225264 by mrartist
Thanks for that, with all this REGEX stuff I'm completely ignorant.

Is there somewhere on Joomlapolis where all these useful expressions have been collated, or a quick tips section of useful things to know like the key important links to the various CB, GJ, Subs, etc. components?

I know there would probably be loads of possible combinations, but the only way of finding them seems to be almost by accident after trawling through these forums.

Any chance of a quick reference chart somewhere?

Many thanks

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48465
  • Thanks: 8280
  • Karma: 1443
11 years 6 months ago #225266 by krileon
REGEX is just a standard usage throughout several coding languages. You can learn about REGEX usage below.

www.regular-expressions.info/

Locations within CB and its plugins that support REGEX will directly state they do. I personally use RegexBuddy as it makes life significantly easier when writing REGEX.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • mrartist
  • mrartist
  • OFFLINE
  • Posts: 51
  • Thanks: 9
  • Karma: 1
11 years 6 months ago #225275 by mrartist
Thanks for the tip and encouragement. I shall explore.

I think part of my problem with this might be more knowing what CAN be achieved rather than how. i.e. what other permutations could be applied to the various places I could apply REGEX within CB/GJ. I think that's what I mean about a quick reference page, a place that might contain some cool tips of what can be done, some of which I've come across (and forgotten about as they weren't relevant at the time) as I roam the Joomplapolis forum.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48465
  • Thanks: 8280
  • Karma: 1443
11 years 6 months ago #225287 by krileon
You're only limited by what REGEX is capable of doing so that's not really something we can measure or provide a guide for. If the area supports REGEX then all REGEX usages should work there. There's a lot of pre-done REGEX around the web too for really complex things. RegexBuddy also makes it incredibly easy to write and test your own REGEX.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum