Regex in Zoho Mail custom filters is not supported - but it works!

Regex in Zoho Mail custom filters is not supported - but it works!

I recently asked Zoho for help using regex in Zoho Mail custom filters and was told it was NOT supported.
This was surprising (and frustrating) as regex in Zoho Mail certainly works, although it does have some quirks*

To encourage others, here are 3 regex examples I created in mail custom filters that have worked fine for me.

Spoiler: I'm not a coder so these examples took me a lot of searching (thanks to others on this site) and tinkering to get the job done — if anyone has improvements on these regex examples, I'm very happy for you to offer them.

Regex examples

1) Purpose: to find all Jpeg, Jpg and Png image urls in email content
regex = "(https?:\/\/[^\s'\"]+?\.(?:jpg|jpeg|png))";

2) Purpose: to find all image urls in email content
regex = '<img[^>]*src="(https?:[^\s,">]*)"';

3) Purpose: to remove unwanted characters in email content, leaving only the urls matched in examples 1 and 2
regex = "\A[\s\S]+?\|\||\|\|[\s\S]+?\||\|\|[\s\S]+?\Z";

Regex explanation and script examples:

1) regex = "(https?:\/\/[^\s'\"]+?\.(?:jpg|jpeg|png))";

(...)                        outer brackets allow match to be captured by variable $1
https?                  ? makes the previous char optional, so matches http or https
:                            literal colon
\/\/                      '\' is required to escape '/' so \/\/, matches '//'
[^...]                      ^ = don't match chars in square brackets
\s                          = white space
'                             = single quote
\"                           = escaped double quote — matches double quote
                               (if i had used single quotes, instead of double, around the whole regex
                                I wouldn't have needed to escape the double quote here)
                              So, [^\s'\"] means match any char EXCEPT white space, single or double quotes
+                           + = match one or more of the chars in square brackets
?                            ? = match the LEAST number of chars (lazy match)
\.                           = escaped dot matches an actual dot (without escape, the dot would match any char except newline)
(?:...)                      ?: = this bracketed group will not be captured by any variable
jpg|jpeg|png         the pipe means 'OR' so this group matches jpg OR jpeg OR png

Script Example
foundUrls = mailContent.replaceall(regex,"||$1||");

Here the $1 variable captures the regex match between (...) so, "||$1||" means 'replace each match with a double pipe and the match, and a double pipe. i.e. place a double pipe around each matched URL.


2) regex = '<img[^>]*src="(https?:[^\s,">]*)"';

'....'                              using single quotes means it's not necessary to escape the double quotes inside the regex
<img                          matches liters <img 
[^>]                            match any character EXCEPT >
*                                 match the chars in the square brackets zero or multiple times
src="                          match literal src="
(...)                              the match inside the brackets is saved to variable $1
https?                        match http or https (? means previous char is optional)
:                                  literal colon
[^\s,">]*                     match any character EXCEPT white space, double quote, chevron — zero or multiple times
"                                  the match must finish with a double quote

NB: the captured variable $1 will only contain the URL from http up to, but not including the final double quote

Script Example

foundUrls = MailContent.replaceAll(regex,"||$1||");

Here, the 'long' URL (<img.. src..."http...) is replaced by the 'short' URL (http....) and surrounded by double pipes


3) regex = "\A[\s\S]+?\|\||\|\|[\s\S]+?\||\|\|[\s\S]+?\Z";

The regex has three options for a match, each separated by a pipe meaning 'OR'

First option:
 \A                  = Start Of File (i.e search from the beginning of the file)
 [\s\S]             matches any white space (\s) and any non-white space (\S)
 +                     + = match one or more of the chars in square brackets
?                       ? = match the LEAST number of characters necessary (lazy match)            
 \|\|                  '\' escapes the pipes so matches '||' (without escape the pipes would be read as 'OR')
 |                       unescaped pipe = OR (i.e. match either first OR second parts of the regex)
 
Second option:
 \|\|                  escaped pipes, so matches '||' 
[\s\S]+?           match any space or non-space one or more times, but use the LEAST chars necessary
\|                      escaped pipe, so matches '|' (NB: when this group is deleted it will leave one pipe between URLs) 
|                        unescaped pipe = 'OR' (ie match second OR third parts of the regex)

Third option
\|\|                    escaped pipes, matches '||' 
[\s\S]+?            match any space or non-space one or more times, but use the LEAST chars necessary
\Z                     = End Of File (i.e. search to the end of the file)

Script example

 cleanUrls = foundUrls.replaceAll(regex,"");

Thus
Option 1: 'StartOfFile up to and including '||' gets deleted.
Option 2: '||' to '|' inclusive gets deleted (leaving one pipe between URLs)
Option 3: '||' to EndOfFile gets deleted

Replacing the single pipes with commas to form a list of URLs is accomplished with:
urls = cleanUrls.toList("|");

NB These scripts use pipes to bracket and separate URLS It's therefore prudent, BEFORE applying the scripts, to remove any existing pipes from the selected text:

regex = '\|';
cleanMailContent = mailContent.replaceAll(regex,"");

* Quirks of Zoho Mail Deluge 

While the scripting language is similar to JavaScript it is not identical and some features of Regex do not work.
In particular, I've not had success using 'lookahead' or 'lookbehind' operations in Zoho Mail custom filters.



    • Sticky Posts

    • Pocket from Mozilla is closing shop. Don’t lose your favorites . Move them to Zoho Mail Bookmarks now! 📥🔖

      The end of Pocket shouldn't mean the end of your important links and content. Easily import them into Zoho Mail's Bookmarks and continue right where you left off. You can bring over your entire Saves, Collections, and tags just the way they are. Bookmarks
    • Zoho Mail POP & IMAP Server Details

      Hello all! We have been receiving a number of requests regarding the errors while configuring or using Zoho Mail account in POP/ IMAP clients. The server details vary based on your account type and the Datacenter in which your account is setup. Ensure
    • Workplace - Zoholics Europe Customer Awards

      Dear Zoho Mail Community! 📣 We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! Workplace - Zoholics Europe Customer Awards This is your chance to shout about the amazing
    • Important update on Group Management | Zoho Mail

      Dear Zoho Mail Community, This post is to inform you all of the following updates on the Group Management in Zoho Mail. Group Member Addition: If a group member is added to an organization group in a Zoho Application, the member will be automatically
    • Mastering email etiquette and best practices to follow in Zoho Mail

      Hello Zoho Mail Community, We’re thrilled to invite you all to our upcoming webinar: Mastering email etiquette and best practices to follow in Zoho Mail. Join our live webinar for expert etiquette tips to enhance your professionalism and elevate your
    • Recent Topics

    • CRM x WorkDrive: File storage for new CRM signups is now powered by WorkDrive

      Availability Editions: All DCs: All Release plan: Released for new signups in all DCs. It will be enabled for existing users in a phased manner in the upcoming months. Help documentation: Documents in Zoho CRM Manage folders in Documents tab Manage files
    • Is there a way to automatically add Secondary Contacts (CCs) when creating a new ticket for specific customers?

      Some of our customers want multiple contacts to receive all notifications from our support team. Is there a way to automatically add secondary contacts to a ticket when our support team opens a new ticket and associates it with an account? This would
    • Does Zoho Learn integrate with Zoho Connect,People,Workdrive,Project,Desk?

      Can we propose Zoho LEarn as a centralised Knowledge Portal tool that can get synched with the other Zoho products and serve as a central Knowledge repository?
    • Shopify Extension no longer working in CRM

      Zoho CRM and Extension are no longer working properly. We have used Shopify Basic for years. All of the sudden it stopped working, then started working again, and now no longer working again. There are several ways for Personal Information to sync from
    • Add Comprehensive Accessibility Features to Zoho Writer

      Hello Zoho Writer Team, We hope you are doing well. We would like to submit a feature request to enhance Zoho Writer with a full set of accessibility tools, similar to the accessibility options already available in the Zoho Desk agent interface. 🚧 Current
    • If there’s a batch at the end, the ‘mark as inactive’ function doesn’t work.

      when my batch has a date to batch end and I "mark as inactive" he batch does not obey the status and reactivates the batch.
    • Changing an agents email address

      How do you change an agent's email address? I keep getting a red circle even though I am an admin. And on one of my agents he has two email addresses? How is that possible?
    • Having Trouble Opening The Candidate Portal

      Recently am having trouble opening the Candidate Portal. It keeps loading but cannot display any widgets. Tried Safari, Chrome and Edge. Non of them work. Please solve the problem ASAP.
    • Signature issue

      Problem: The signature does not appear when replying or forwarding an email. solve issue: settintgs/Signature Check option place a signature above the content with quotation marks
    • Feature Suggestion for Zoho Websites – Inspired by Squarespace Systems

      Dear Zoho Team, I’m a Zoho user and also a Squarespace Platinum Circle member, and I recently noticed the launch of Zoho Websites in India. I wanted to share some ideas for features that could enhance the platform for professional users and agencies.
    • Customer happiness customisation

      Hi, I was wondering if it's possible to somehow customise to whom and when customer happiness request is sent? Can you enable it only for selected tickets for example based on workflow or any other criteria (customer name, tag or anything else)? Also
    • Custom View - Sort by Custom Field

      I created a custom field for our Engineering team to know which tickets to work first by numbering them.  I created a custom view to general data which includes the Engineering Priority.  However, I cannot sort the Engineering Priority column ascending
    • Advanced Deluge help needed with custom function and COQL limits

      I have a scheduled function that takes a snapshot of specific metrics and saves them to a custom module. However I'm struggling with the limits of COQL. I attach my full code, but an example of the issues I'm having is that it's erroring with a 'Limit
    • Format a "return" message

      Good day, Is there a way to format the message of the "return" function in CRM deluge script?
    • Cliq iOS can't see shared screen

      Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
    • Default Sorting on Related Lists

      Is it possible to set the default sorting options on the related lists. For example on the Contact Details view I have related lists for activities, emails, products cases, notes etc... currently: Activities 'created date' newest first Emails - 'created
    • Microsoft Teams now available as an online meeting provider

      Hello everyone, We're pleased to announce that Zoho CRM now supports Microsoft Teams as an online meeting provider—alongside the other providers already available. Admins can enable Microsoft Teams directly from the Preferences tab under the Meetings
    • Mass (Pull back) (Close WOs) (Close APs)

      Hi develop team. Just idea because Zoho FSM is great but its too manual. we have a lot of task to do every day and the system needs to have more features to automatic our tasks. I need to close several WOs, APs and Pull Back per day. Please we need mass
    • Outdated state in mexico

      Hello Zoho team, the drop down to add the state for customers, when they introduce their state in mexico has a city named “Distrito Federal” that name changed many years ago to “ciudad de mexico”. could you please update this so my clients can find the
    • Zoho Indeed Intergation not pulling candidate details

      We have recently integrated zoho with indeed. Prior to this our candidates came into the candidates tab via the zoho.resumes email address from indeed and it pulled through the candidates mobile number, and majority of the time a postcode. However since
    • Custom View of tickets created today

      How can I create a custom view that list all my ticked created in the current date? Currently, if I select the "Created Time" criteria, the "Current Time" option does not work as today. Actually, I don't know how it works this "Current Time".
    • Lifecycle Reports

      From data to decisions: A deep dive into ticketing system reports A lifecycle report captures and visualises the sequential states that a ticket undergoes across its lifespan. For instance, when a customer submits a support ticket for a faulty product,
    • Zoho Forms - Print Button on Forms

      Hi Forms team, I'm replicating a form for a client which is currently based on JotForm. I noticed that at the end of the form there is a button to print the completed form. I thought this would be something worth sharing and a nice to have in Zoho Forms.
    • Help with Filtering Records, HTML Pages, and Automatic File Uploads in Zoho Creator

      Hi Zoho Creator Community, I’m building a Zoho Creator application and need guidance on a few features I’ve been struggling with. I want to implement them safely and efficiently, and I’d appreciate any examples, tips, or best practices. I want users to
    • Putting Watermark on Zoho Sheet

      Can this be done?
    • Validation function not preventing candidates under 18 or over 30 from submitting the web form

      Hello everyone, I’m trying to create a validation rule for the Candidate Webform in Zoho Recruit. I added a custom field called “Date of Birth”, and I want to make sure that candidates cannot submit the form unless their age is between 18 and 30 years.
    • Report to know the history of certain Tickets on Desk

      Hi there guys, As the title implies we're wondering if there's any way to get some kind of Report that allows us to check the History of various Tickets at the same time since as of today if we want to know that we have to check them 1 by 1 which is not
    • Shared Mailboxes Disappeared

      Zoho Mail users in our company haven't been able to see their Shared Mailboxes for the past few hours. I've checked with App and Web Access, but they can't access them. When I send emails to their addresses, I get no error messages. They're still visible
    • IMAP Migration from Gmail

      I have been trying to import my email from a Gmail server and keep receiving the following error. I have reduced the security, activated imap and no improvement. The link to the Google support item has not helped. Unable to connect to your account. Please
    • Advanced Usage Billing: Prepaid with Drawdown

      Picture yourself at your favourite coffee shop, Bean & Brew. You come by every morning for your usual cappuccino, and occasionally you get an extra cold brew and a muffin or two in the afternoon. Interestingly, Bean & Brew has a new idea of offering a
    • Experience effortless record management in CRM For Everyone with the all-new Grid View!

      Hello Everyone, Hope you are well! As part of our ongoing series of feature announcements for Zoho CRM For Everyone, we’re excited to bring you another type of module view : Grid View. In addition to Kanban view, List view, Canvas view, Chart view and
    • Zoho CRM - Potentials Tab

      Hi! When I create a Deal (Potentials tab) the header looks like this: After a refresh on the page it looks like this: What should I do so that it is displayed like in the second pic without refresh? Also I have a user that as of recently, cannot see this
    • Good news! Calendar in Zoho CRM gets a face lift

      Dear Customers, We are delighted to unveil the revamped calendar UI in Zoho CRM. With a complete visual overhaul aligned with CRM for Everyone, the calendar now offers a more intuitive and flexible scheduling experience. What’s new? Distinguish activities
    • How can I bold text on Zoho Forms submit buttons?

      In the old theme builder, I could bold the text on a form's submit button. With the new theme builder, I can only change the text of the header or fields in the form, and not the button itself.
    • Zoho Commerce in multiple languages

      When will you be able to offer Zoho Commerce in more languages? We sell in multiple markets and want to be able to offer a local version of our webshop. What does the roadmap look like?
    • Urgent Zoho Creator down!!!???

      Now my zoho creator faced this issue. Anyone has idea? Urgent!!!
    • Using IMAP configuration for shared email inboxes

      Our customer service team utilizes shared email boxes to allow multiple people to view and handle incoming customer requests. For example, the customer sends an email to info@xxxx.com and multiple people can view it and handle the request. How can I configure
    • The Social Wall: September 2025

      Hello everyone, As we step into the fall season, some major updates are on the horizon. Meanwhile, here are the exciting updates we rolled out this September. Approvals in iOS Managing approvals just got more seamless on mobile. With this update, the
    • Display Client Name in Zoho Creator Client Portal Dashboard

      Hello Zoho Creator Team, We hope you are doing well. Zoho Creator recently introduced the option to set a client’s display name in the Client Portal settings, which is very helpful for providing a personalized portal experience. However, there is currently
    • Introducing Detailed View for Candidates in Vendor Portal

      We’ve added a new Details sub-tab inside the Vendor Portal to help vendors easily view complete candidate information after submission. With this update, vendors can now access all candidate details, from personal information to associated job openings,
    • Next Page