Articles on: FAQs

What are Regular Expressions and Super-Tags in DANAconnect?

Articles on: FAQs

What are DANAconnect's Super-Tags?
DANAconnect's Super-Tags are variables that are inserted into the contents of DANAconnect message flows in which commands can be incorporated in order to display only a part of the text that contains that variable. The commands that are incorporated correspond to regular expressions and substrings of text (see definitions below).

What are Super-Tags used for in email, bulk SMS, and digital communication?
Super-Tags are used to extract, filter and display specific parts of a longer text in digital communications without the need to create additional fields in the database.

I'm not a programmer: How do I use Super-Tags?
DANAconnect offers a library of most common uses of Super-Tags with concrete examples to copy and paste. See the library

I'm a programmer: How do I use Super-Tags?
You can see how to form Super-Tags in the following article: How to Form Tags with Regular Expressions and/or Substrings (Super-Tags)

What are Regular Expressions?
Regular expressions, commonly referred to as regex, are a specially coded set of character strings (i.e. [A-Z]+ or .*), which is used to match simple or complex text patterns. The regular expression can search, join, replace, split into substrings, parse, and split text. The last three are the most exploited functions in programming. An applied example of regular expression that we use on a daily basis is the “Search and Replace” functionality in Word, or the “Ctrl-F” search in documents and webpages.

The use of regular expressions is possible in most programming languages (e.g. JavaScript, Python, PHP), online applications and tools like DANAconnect, databases like MySQL, and many many more.

What are Substrings or Substrings?
In formal language theory and computer science, a substring or substring is a contiguous sequence of characters within a string. For example, "the best of" is a substring of "It was the best of all". On the other hand, "eramejor" is a subsequence of "It was the best of all", but not a substring.

What are the basic uses of regular expressions?

Validate: It will determine if your pattern matches a string of text characters, returning a boolean value (true or false).

Extract/Search: It will search through a large string to find pieces that match your own pattern.

Subtract/Replace: It will search through large strings of text to find substrings that match your own pattern and replace them with any other specified string.

Divide: It will remove parts of the string that match the specified pattern.



What are the most common regular expressions?
Here is a list of the most common patterns collections:

[A-Z] Matches any uppercase character from "A" to "Z"

[a-z] Matches any lowercase character from "a" to "z"

[0-9] Matches any number

[asdf] Matches any character that is "a", "s", "d" or "f"

[^asdf] Matches any character that is not any of the following: "a", "s", "d" or "f"


What are regular expressions tokens?

Not all characters are as easily identifiable. While characters like "a" to "z" make sense for matching regular expressions usage, what about the character that represents a line break?

The "line break" character is the character that is entered every time you press "Enter" to add a new line.

\n Matches the line break character

\t Matches the tab character

\s Matches any whitespace character (including \t, \n)

\S Matches any character that is not a whitespace

\w Any character that is letter, number or underscore (Latin alphabet)

\W Any character that is not letter, number or underscore

\b Matches the boundaries between \w and \W, but with the intermediate characters

\B Matches the non-word boundary: the inverse of \b

^ Matches the beginning of a line

$ Matches the end of a line

\ Matches the literal character "\"

. Matches any character


What are word boundaries?
Word Boundary: \b
The word boundary \b matches positions where one side is a word character (usually a letter, digit, or underscore) and the other side is not a word character (for example, it may be the beginning of the string or a whitespace character).

Updated on: 05/02/2023

Updated on: 09/13/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!