How to use regular expressions in formulas | Zoho Sheet

Regular expressions in formulas

Regular expressions are patterns that can be used to include single or multiple characters in search. While Wildcards can be used for simple searches, regular expressions can be applied for advanced use cases.
 
The patterns used in regular expressions can consist of a combination of characters, operators, and constructs. Let's look at each category of patterns and their use in regular expressions.
 
Characters 
Below are the frequently used characters for search via regex. The backslash indicates that the following character has a special meaning during search.
Character
Description
Sample Pattern
Sample Matches
\d
Matches any digit character from 0 to 9.
\d
2 in a2z
0 in a-a=0
\D
Matches any character that is not a digit.
\D
a and z in a2z
a and a in a-a=0
\n
 
 
 
\s
Matches any whitespace character like space, tab, new line.
.\s.
o and S in Zoho Sheet
n and 5 in
Version
5
\S
Matches any non-whitespace character.
\S
Zoho and Sheet in Zoho Sheet
Version and 5 in
Version
5
\t
Matches a tab.
.\t
o in Zoho\tSheet
\w
Matches any alphanumeric character including ASCII letters, digits, and underscore.
\w
Hello in Hello!
email in @email
\W
Matches any character excluding alphanumeric characters and underscore.
\W
! in Hello!
@ in @email
.
Matches any single character except line break.
.en
hen, pen, ten, @en
\
Escapes the special meaning of a character during search. Eg., "\." can be used to search for "."
\w+\.
Mr. and Mrs.
 
 
Character Classes 
Character classes can be used to match anyone of the given set of characters, including letters, digits, and symbols. By default, the matches are case-sensitive.
 
 
Character Class
Description
Sample Pattern
Sample Matches
[characters]
Matches any single character given in the brackets.
h[iu]t
hit, hut
[^characters]
Matches any single character not given in the brackets.
h[^iu]t
h@t, hat, hot
[from-to]
Matches any single character in the range given in brackets.
[a-z]
[A-Z]
[0-9]
Any letter in lowercase
Any letter in uppercase
Any digit from 0 to 9
 
Quantifiers 
Quantifiers specify the number of occurrences of a character/character class/a group for a match. Applies to the preceding character.
 
Quantifier
Description
Sample Pattern
Sample Matches
*
Matches previous element zero or more times.
she*
sh, she, shee in sheet
+
Matches previous element one or more times.
she+
she, shee in sheet
?
Matches previous element zero or one time.
br?at
brat, bat
*?
Matches the previous element zero or more times, but as few times as possible.
she*?
sh in sheet
+?
Matches the previous element one or more times, but as few times as possible.
she+?
she in sheet
??
Matches the previous element zero or one time, but as few times as possible.
br??at
bat
{n}
Matches the previous element "n" times.
ab{4}
Order10{3}
abbbb
Order1000
{n,}
Matches the previous element "n" or more times.
ab{2,}
Order10{1,}
abb, abbb,...
Order10, Order100, Order1000,...
{n,m}
Matches the previous element between "n" and "m" times.
ab{2,4}
Order10{0,1}
abb, abbb, abbbb
Order1, Order10
{n,}?
Matches the previous element "n" or more times, but as few times as possible.
\d{3,}?
123, 1234
{n,m}?
Matches the previous element between "n" and "m" times, but as few times as possible.
\d{2,5}?
12, 123
 
Anchors 
Anchors can be used to specify a position in the given string for a match.
 
 
Anchor
Description
Sample Pattern
Sample Matches
^
The match must occur at the start of the given string. In multiline strings, it must occur at the start of the line.
^\d{1}
2 in 2 Orders
$
The match must occur at the end of the given string, or before \n at end of string. In multiline strings, it must occur at the end of the line or before \n at the end of line.
\d{4}$
1234 in Emp ID 1234
\A
The match must occur at the start of the given string.
\A\d{1}
2 in 2 Orders
\b
The match occur within a boundary between a /w and a /W character.
\bsheet\b
sheet in zoho sheet but not in spreadsheet
\B
The match must not occur within a \b boundary.
\bsheet\b
sheet in spreadsheet but not in zoho sheet
\G
The match must occur at the position where the previous match ended. In case of no previous match, then at the position in string where the matching started.
 
 
\z
The match must occur at the end of the string.
\d{4}\z
1234 in Emp ID 1234
\Z
The match must occur at end of the string or before \n at the end of string.
\d{4}\Z
1234 in Emp ID 1234
 
Zoho Sheet supports both Wildcards and regular expressions for match. Click here to learn more about the wildcard characters and their examples.

    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION








                                You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                    Manage your brands on social media

                                      Zoho Desk Resources

                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day


                                        Zoho Marketing Automation

                                          Zoho Sheet Resources

                                           

                                              Zoho Forms Resources


                                                Secure your business
                                                communication with Zoho Mail


                                                Mail on the move with
                                                Zoho Mail mobile application

                                                  Stay on top of your schedule
                                                  at all times


                                                  Carry your calendar with you
                                                  Anytime, anywhere




                                                        Zoho Sign Resources

                                                          Sign, Paperless!

                                                          Sign and send business documents on the go!

                                                          Get Started Now




                                                                  Zoho TeamInbox Resources



                                                                          Zoho DataPrep Resources



                                                                            Zoho DataPrep Demo

                                                                            Get a personalized demo or POC

                                                                            REGISTER NOW


                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now







                                                                                            You are currently viewing the help articles of Sprints 1.0. If you are a user of 2.0, please refer here.

                                                                                            You are currently viewing the help articles of Sprints 2.0. If you are a user of 1.0, please refer here.



                                                                                                  • Related Articles

                                                                                                  • Wildcard characters in formulas

                                                                                                    Wildcard characters help you search for terms with iterations of single or multiple characters. Wildcards can be used in formulas such as XLOOKUP to include relevant terms in match.   Below is the list of wildcard characters and their use cases:   ...
                                                                                                  • Use functions and formulas

                                                                                                    To use a predefined or custom function in your spreadsheet: Double tap on the cell where you want the result to be displayed. Start with an equal sign (=), then type the desired function's name. While typing, you can also choose from the function ...
                                                                                                  • Insert functions and formulas

                                                                                                    To insert functions or formulas: Enter = in any desired cell and type in the formula or function. Alternatively, go to the menu bar and tap Insert. Under the Insert menu, choose Function. Zoho Sheet supports 400+ functions and you can choose the ...
                                                                                                  • Use Functions and Formulas

                                                                                                    To use a predefined or custom function in your spreadsheet: Double-tap on the cell where you want the result to be displayed. Tap the = sign, then type the desired function's name. While typing, you can also choose from the function suggestions shown ...
                                                                                                  • Locale and calculation settings in your spreadsheet

                                                                                                    To change the locale settings: Go to File > Spreadsheet Settings. In the Spreadsheet Settings tab under Locale, you can edit the Country, Language, Time Zone and Display Direction using the respective drop-downs. Changing a spreadsheet's locale will ...
                                                                                                    Wherever you are is as good as
                                                                                                    your workplace

                                                                                                      Resources

                                                                                                      Videos

                                                                                                      Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                      eBooks

                                                                                                      Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                      Webinars

                                                                                                      Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                      CRM Tips

                                                                                                      Make the most of Zoho CRM with these useful tips.



                                                                                                        Zoho Show Resources