String Functions + Regex
1. CONCAT
CONCAT(string1, string2, ...): Concatenates multiple strings.
2. LENGTH
LENGTH(string): Returns the length of a string.
3. TRIM, LTRIM and RTRIM
TRIM(string): Removes leading and trailing whitespace from a string.LTRIM(string): Removes leading whitespace from a string.RTRIM(string): Removes trailing whitespace from a string.
4. SUBSTRING
SUBSTRING(string, start, length): Extracts a substring from a string.
start: The position within the string where the extraction begins.length: The number of characters to extract from the string, starting from thestartposition.
5. REPLACE
REPLACE(string, old_string, new_string): Replaces occurrences of one string with another.
old_string:The substring that you want to replace.new_string:The substring that will replaceold_string.
6. LOWER and UPPER
LOWER(string): Converts a string to lowercase.UPPER(string): Converts a string to uppercase.
7. SPLIT (BigQuery)
SPLIT(string, delimiter): Split a string into an array of substrings based on a specified delimiter
delimiter:The character or sequence of characters used to determine where the splits in the string occur.
8. Syntax: .
A wildcard that represents any character (except newline character).
9. Syntax: *
Zero or more occurrences.
10. Syntax: +
One or more occurrences.
11. Syntax: ?
Zero or one occurrences.
12. Syntax: ^pattern
Placeholder that signifies beginning of a line. Starts with the pattern.
13. Syntax: pattern$
Placeholder that signifies the end of a line. Ends with the patterns.
14. Syntax: ^pattern$
When
^ and $ are used together, they ensure that the entire string conforms to the specified pattern, not just a part of it.
15. Syntax: |
Acts as a logical OR, allowing you to specify alternative patterns.
16. Syntax: ()
Parentheses are used to group characters or subpatterns together.
17. Syntax: {}
Curly brackets are used to specify the number of occurrences or a range of occurrences of a character or a group of character.
18. Syntax: [ab]
To match a set of characters inside the square brackets. It returns a match where one of the specified characters (
a,b) is present.
19. Syntax: [^ab]
To match all characters that are not inside the square brackets. It returns a match for any character except for
a and b.
20. Syntax: [a-c]
To match for the range of characters between
a and c.
21. Syntax: [a-cm]
To match for the range of characters..
- between
aandc - Or the character
m.
22. Syntax: [a-cA-Cx]
To match for the range of characters,
- between
aandclowercase, - between
AandCuppercase or x.