By continuing to use this site, you agree to the storing of first- and third-party cookies on your device to enhance site navigation; analyze site, product, and service usage; and assist in our marketing and promotional efforts. Cookie Policy

Skip to Content


Regex, short for "regular expression," is a sequence of characters that set a pattern used to define either the allowed or disallowed characters and character strings in a naming convention. Regex can define characters, cases, symbols, naming structures, and lengths.

Regex is used throughout Omni CMS, in locations such as site settings for file naming and binary file naming, and find and replace.

File NamingLink to this section

Use following regex in file naming settings to restrict which characters are allowed to users when naming files.

SymbolDescriptionSample RegexSample DefinitionExamples
[ - ]Range indicator[a-z]One lower case (LC) letter from a thru zd, or a, or z
[ - ]Range indicator[a-zA-Z]One LC or upper case (UC) letterD, or d, or A
[ - ]Range indicator[a-zA-Z0-9]One LC, UC, or number(#)d, or D, or 1
*No limit in characters[a-zA-Z]*Any LC or UC of any lengthLongfileName
{ }Set Character Limit[a-zA-Z]{5}Any LC or UC exactly 5 characters in Lengthaaaaa, AasAc, hhhhH
{ , }Set Character Range[a-zA-Z]{2,5}Any LC or UC between 2 to 5 characters in LengthaAa, abCd, abcdE
{ , }Set Minimum Character Range[a-zA-Z]{2,}Any LC or UC a minimum of 2 characters in Lengthaaa, ababA, Filename
[ - ]*[ . ]Add required punctuation[a-zA-Z]*[.]Any LC or UC of any length ending in a .test. Sample. nAme.
[ - ]*[ . ][ - ]Add defined extension rules[a-zA-Z]*[.] [a-z]Any LC or UC of any length ending with a . with an extension of 1 character made of any LC a-ztest.a, name.b, words.c
[ - ]*[ . ][ - ]{ , }Add a range for the extension[a-zA-Z]*[.] [a-z]{2,4}Any LC or UC of any length ending with a . with an extension of 2 to 4 characters made of any LC a-zName.tif, image.jpg, document.docx
[|]Boolean, 'or'[a-zA-Z]*[.] [jpg|jpeg|txt|pdf]{3,4}Any LC or UC of any length ending with a . with an extension limited to jpg, jpeg, txt, or pdfimage.jpg, image.jpeg, doc.txt, doc.pdf
\Add restricted Character[a-zA-Z\-]*[.] [a-z]{2,4}Any LC or UC or - of any length ending with a . with an extension of 2 to 4 characters made of any LC a-zimage-new.jpg

* LC = lower case, UC = upper case

Use the following regex when searching (such as a find and replace with regex) to find content that fits criteria more complicated than simple text matches.

SymbolDescriptionSample RegexSample DefinitionExamples
[]Search Range[z]Search for any lower case zPEz, zebrA
( )Search Group(pdf)Look for any grouping of pdf in filenames or codedocument.pdf, /xsl/catalog/pdf/courses
\.Special Character(\.pdf)Look for any grouping that includes .pdf document.pdf, file.pdf
^Negated, Not[^A-Z]Match everything that is NOT an uppercase A-ZThis is an Example of This REgEX
?Match as few characters as possible([o]{2}?)Match any word that has two o's next to each otherFootcode, Prefooter,
(|)Boolean, "or"(jpg|gif|pdf)Match any of the sequences of textimage.jpg, document.pdf, file.gif