For Zoho Services only:


I'm actually part of a bigger team at Ascent Business Solutions where we have support technicians and project consultants. Support is for smaller technical fixes but this can include developments, reports or integrations; depending on the size of the task. Projects are for more time-consuming developments such as revamps of the Zoho Suite of apps or on-site training. The advantage of a team is that if I am out-of-office for a day or so, there is always someone at Ascent Business Solutions who can deal with any queries/issues you may have.

Our support rates can be found and purchased at http://ascentbusiness.co.uk/zoho-support-2. A support bundle doesn't have an expiry date. So whether we can do what you want within the bundle and a year later need further support, if there are minutes left on the bundle then there is no additional charge.

Our project rates for bigger developments can be found at http://ascentbusiness.co.uk/crm-solutions/zoho-crm-packages-prices and will involve a dedicated project consultant along with developers who will hold your hand through the development process.

If you want help building a solution for one of the Zoho Apps in the Zoho Suite, contact us on 0121 293 8140 (UK) or by email at info@ascentbusiness.co.uk. You can also visit our website at http://ascentbusiness.co.uk.

I regularly build and specialize in 2-way API integrations for Xero, Shopify and eBay.

Zoho Deluge - Some Useful Regular Expressions

What
A more comprehensive post on some other regex (regular expressions) to format values in Zoho.

How?
The following will remove any non-digits:
copyraw
v_MyString = "<b>Hello World 123</b>";
v_MyFormattedString = v_MyString.replaceAll("[^0-9]","");
// yields 123
  1.  v_MyString = "<b>Hello World 123</b>"
  2.  v_MyFormattedString = v_MyString.replaceAll("[^0-9]","")
  3.  // yields 123 

The following will strip all HTML/XML tags:
copyraw
v_MyString = "<b style='color:red'>Hello World 123</b>";
v_MyFormattedString = v_MyString.replaceAll("<(.|\n)*?>","");
// yields Hello World 123
  1.  v_MyString = "<b style='color:red'>Hello World 123</b>"
  2.  v_MyFormattedString = v_MyString.replaceAll("<(.|\n)*?>","")
  3.  // yields Hello World 123 

URL safe slug:
copyraw
v_MyString = "Hello World 123";
v_MyFormattedString = v_MyString.toLowerCase().replaceAll(" ","-");
v_MyFormattedString = v_MyFormattedString.replaceAll("[^a-z0-9-]+","");
// yields hello-world-123
  1.  v_MyString = "Hello World 123"
  2.  v_MyFormattedString = v_MyString.toLowerCase().replaceAll(" ","-")
  3.  v_MyFormattedString = v_MyFormattedString.replaceAll("[^a-z0-9-]+","")
  4.  // yields hello-world-123 

Email safe string:
copyraw
v_MyString = "somewhere[]@beyondthesea_1.com";
v_MyFormattedString = v_MyString.toLowerCase().trim();
v_MyFormattedString = v_MyFormattedString.replaceAll("[^a-z0-9@\-.]+","");
// yields This email address is being protected from spambots. You need JavaScript enabled to view it.
  1.  v_MyString = "somewhere[]@beyondthesea_1.com"
  2.  v_MyFormattedString = v_MyString.toLowerCase().trim()
  3.  v_MyFormattedString = v_MyFormattedString.replaceAll("[^a-z0-9@\-.]+","")
  4.  // yields This email address is being protected from spambots. You need JavaScript enabled to view it. 

Replace any duplicates:
copyraw
v_MyString = "Hello World Hello Joe";
v_MyFormattedString = v_MyString.replaceAll("(\b\w+\b)(?=.*\b\1\b)","");
// yields World Hello Joe
  1.  v_MyString = "Hello World Hello Joe"
  2.  v_MyFormattedString = v_MyString.replaceAll("(\b\w+\b)(?=.*\b\1\b)","")
  3.  // yields World Hello Joe 

Remove block comments:
copyraw
v_MyRegEx = "(\/\*([^*]|(\*+[^*\/]))*\*+\/)";
v_MyString = "String to output: /* this is a comment */";
v_MyFormattedString = v_MyString.replaceAll(v_MyRegEx,"");
// yields String to output:
  1.  v_MyRegEx = "(\/\*([^*]|(\*+[^*\/]))*\*+\/)"
  2.  v_MyString = "String to output: /* this is a comment */"
  3.  v_MyFormattedString = v_MyString.replaceAll(v_MyRegEx,"")
  4.  // yields string to output: 

Zoho Deluge Validation Checking by Regular Expression:

So I could do it the long way in Zoho Deluge. We match a pattern and replace everything out that conforms to the criteria so a true response will be an empty string:
copyraw
v_MyRegEx = "^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\.[A-Za-z]{2,}$";
v_MyString = "This email address is being protected from spambots. You need JavaScript enabled to view it.";
v_MyFormattedString = v_MyString.replaceAll(v_MyRegEx,"");
b_Ok = if( v_MyFormattedString == "", true, false);
// yields true

v_MyString = "somewhere[]@beyondthesea_1.com";
v_MyFormattedString = v_MyString.replaceAll(v_MyRegEx,"");
b_Ok = if( v_MyFormattedString == "", true, false);
// yields false
  1.  v_MyRegEx = "^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\.[A-Za-z]{2,}$"
  2.  v_MyString = "This email address is being protected from spambots. You need JavaScript enabled to view it."
  3.  v_MyFormattedString = v_MyString.replaceAll(v_MyRegEx,"")
  4.  b_Ok = if( v_MyFormattedString == "", true, false)
  5.  // yields true 
  6.   
  7.  v_MyString = "somewhere[]@beyondthesea_1.com"
  8.  v_MyFormattedString = v_MyString.replaceAll(v_MyRegEx,"")
  9.  b_Ok = if( v_MyFormattedString == "", true, false)
  10.  // yields false 

Yay Zoho has "matches". So this is the regex way to do it:
copyraw
v_MyRegEx = "^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\.[A-Za-z]{2,}$";
v_MyString = "This email address is being protected from spambots. You need JavaScript enabled to view it.";
b_Ok = if( v_MyString.matches( v_MyRegEx  ), true, false);
// yields true
  1.  v_MyRegEx = "^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\.[A-Za-z]{2,}$"
  2.  v_MyString = "This email address is being protected from spambots. You need JavaScript enabled to view it."
  3.  b_Ok = if( v_MyString.matches( v_MyRegEx  ), true, false)
  4.  // yields true 

Some other validation checks:
copyraw
// validate UK postcode
v_MyRegEx = "^((([A-PR-UWYZ])([0-9][0-9A-HJKS-UW]?))|(([A-PR-UWYZ][A-HK-Y])([0-9][0-9ABEHMNPRV-Y]?))\s{0,2}(([0-9])([ABD-HJLNP-UW-Z])([ABD-HJLNP-UW-Z])))|(((GI)(R))\s{0,2}((0)(A)(A)))$";
  1.  // validate UK postcode 
  2.  v_MyRegEx = "^((([A-PR-UWYZ])([0-9][0-9A-HJKS-UW]?))|(([A-PR-UWYZ][A-HK-Y])([0-9][0-9ABEHMNPRV-Y]?))\s{0,2}(([0-9])([ABD-HJLNP-UW-Z])([ABD-HJLNP-UW-Z])))|(((GI)(R))\s{0,2}((0)(A)(A)))$"

Some XML bits:
copyraw
v_MyRegEx = "<!\[CDATA\[([^\]]*)\]\]>";
v_MyString = "<tag1><![CDATA[my_real_textual_data]]></tag1>";
v_FormattedString = v_MyString.replaceAll(v_MyRegEx,"$1",false);
// yields <tag1>my_real_textual_data</tag1>
  1.  v_MyRegEx = "<!\[CDATA\[([^\]]*)\]\]>"
  2.  v_MyString = "<tag1><![CDATA[my_real_textual_data]]></tag1>"
  3.  v_FormattedString = v_MyString.replaceAll(v_MyRegEx,"$1",false)
  4.  // yields <tag1>my_real_textual_data</tag1> 


Additional
Since writing this article I found a Zoho page with some other pretty useful regular expressions at https://zoholic.blogspot.com/2015/04/some-usefull-regex-in-zoho.html:

Convert a string of characters to a list:
copyraw
v_MyString = "12345";
l_StringValues = v_MyString.replaceAll("(?)",",",false).removeFirstOccurence(",").removeLastOccurence(",").toList();
// yields list of [1,2,3,4,5]

// NB: "1mySep2mySep3mySep4mySep5".toList("mySep");
// yields list of [1,2,3,4,5]
  1.  v_MyString = "12345"
  2.  l_StringValues = v_MyString.replaceAll("(?)",",",false).removeFirstOccurence(",").removeLastOccurence(",").toList()
  3.  // yields list of [1,2,3,4,5] 
  4.   
  5.  // NB: "1mySep2mySep3mySep4mySep5".toList("mySep")
  6.  // yields list of [1,2,3,4,5] 

Replace any multiple spaces with a single space:
copyraw
v_MyString = "Hello   World!";
v_FormattedString = v_MyString.replaceAll("[ ]+"," ",false); 
// yields Hello World!
  1.  v_MyString = "Hello   World!"
  2.  v_FormattedString = v_MyString.replaceAll("[ ]+"," ",false)
  3.  // yields Hello World! 

Remove consecutive duplicate words:
copyraw
// replace consecutive duplicates
v_MyString = "Hello Hello Joe";
v_FormattedString = v_MyString.replaceAll(("([A-Za-z]+) \1"),"$1",false);
// yields Hello Joe

// NB: v_MyString = "Hello World Hello Joe"
// yields Hello World Hello Joe
  1.  // replace consecutive duplicates 
  2.  v_MyString = "Hello Hello Joe"
  3.  v_FormattedString = v_MyString.replaceAll(("([A-Za-z]+) \1"),"$1",false)
  4.  // yields Hello Joe 
  5.   
  6.  // NB: v_MyString = "Hello World Hello Joe" 
  7.  // yields Hello World Hello Joe 

Escape/Backslash some special characters:
copyraw
v_MyString = "Joe's \"Amazing\" Skill & <His> Grunt";
v_FormattedString = v_MyString.replaceAll(("([&'\"<>])"),"\\$1",false);
// yields Joe\'s \"Amazing\" Skill \& \<His\> Grunt
  1.  v_MyString = "Joe's \"Amazing\" Skill & <His> Grunt"
  2.  v_FormattedString = v_MyString.replaceAll(("([&'\"<>])"),"\\$1",false)
  3.  // yields Joe\'s \"Amazing\" Skill \& \<His\> Grunt 

Replace new lines in returned JSON (invalid in Zoho):
copyraw
v_MyString = "{"MyKey":"MyValue
"}";

// the long way (and cos the regex for this isn't working)
v_FormattedString = v_MyString.replaceAll("\r","",false);  // carriage returns
v_FormattedString = v_MyString.replaceAll("\n","",false);  // line feeds
v_FormattedString = v_MyString.replaceAll("\f","",false);  // form feeds

// a regex that should work but doesn't
v_FormattedString = v_MyString.replaceAll(("([\n\r])"),"",false);
  1.  v_MyString = "{"MyKey":"MyValue 
  2.  "}"
  3.   
  4.  // the long way (and cos the regex for this isn't working) 
  5.  v_FormattedString = v_MyString.replaceAll("\r","",false);  // carriage returns 
  6.  v_FormattedString = v_MyString.replaceAll("\n","",false);  // line feeds 
  7.  v_FormattedString = v_MyString.replaceAll("\f","",false);  // form feeds 
  8.   
  9.  // a regex that should work but doesn't 
  10.  v_FormattedString = v_MyString.replaceAll(("([\n\r])"),"",false)

Split a string by a word:
copyraw
v_MyString = "PoshDavid Beckham";
v_FormattedString = v_MyString.replaceAll("\b(Posh)([^ ]*)","$1 and $2",false);
// yields Posh and David Beckham
  1.  v_MyString = "PoshDavid Beckham"
  2.  v_FormattedString = v_MyString.replaceAll("\b(Posh)([]*)","$1 and $2",false)
  3.  // yields Posh and David Beckham 

UK/US Decimal Separator and Commas:
copyraw
v_MyString = 1234.567;
v_FormattedString = (v_MyString.round(2)).toString().replaceAll(("(?<!\.\d)(?<=\d)(?=(?:\d\d\d)+\b)"),",");
// yields 1,234.57
  1.  v_MyString = 1234.567
  2.  v_FormattedString = (v_MyString.round(2)).toString().replaceAll(("(?<!\.\d)(?<=\d)(?=(?:\d\d\d)+\b)"),",")
  3.  // yields 1,234.57 

European Decimal Separator and Commas:
copyraw
v_MyString = 1234.567;
v_FormattedString = (v_MyString.round(2)).toString().replaceAll("\.",",").replaceAll(("(?<!,\d)(?
  1.  v_MyString = 1234.567
  2.  v_FormattedString = (v_MyString.round(2)).toString().replaceAll("\.",",").replaceAll(("(?<!,\d)(

Extract URL from a link:
copyraw
v_MyString = "<a href=\"https://www.google.com?searchword=Joe\">Link</a>";
v_FormattedString = v_MyString.replaceAll("^.*href\s*=\s*\"([^\"]*)\".*$","$1");
// yields https://www.google.com?searchword=Joe
  1.  v_MyString = "<a href=\"https://www.google.com?searchword=Joe\">Link</a>"
  2.  v_FormattedString = v_MyString.replaceAll("^.*href\s*=\s*\"([^\"]*)\".*$","$1")
  3.  // yields https://www.google.com?searchword=Joe 

Get first 3 words:
copyraw
v_MyString = "I am Joe the Awesomest";
v_FormattedString = v_MyString.replaceAll("^((?:\S+\s+){2}\S+).*","$1",false);
// yields I am Joe
  1.  v_MyString = "I am Joe the Awesomest"
  2.  v_FormattedString = v_MyString.replaceAll("^((?:\S+\s+){2}\S+).*","$1",false)
  3.  // yields I am Joe 

Not a regular expression but something I use to pad months and dates in a date format:
copyraw
v_MyString = 2;  // February
v_FormattedString = leftpad(toString(v_MyString), 2).replaceAll(" ", "0");
// yields "02"
  1.  v_MyString = 2;  // February 
  2.  v_FormattedString = leftpad(toString(v_MyString), 2).replaceAll(" ", "0")
  3.  // yields "02" 
Category: Zoho :: Article: 681

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: The information on this website is provided without warranty and any content is merely the opinion of the author. Please try to test in development environments prior to adapting them to your production environments. The articles are written in good faith and, at the time of print, are working examples used in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Related Articles

Joes Revolver Map

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin - Valid till 8 May 2022 3QnhmaBX7LQSRsC9hh6Je9rGQKEGNQNfPb
© 2021 Joel Lipman .com. All Rights Reserved.