What is RegEx?-Regular Expression or often called RegEx is a set of characters used to search and check a string. The patterns made are very diverse, such as email patterns, cellphone numbers, and so on.
The application of the regex in the application can be used to validate input or input from the user to match the system requirements. Or it can be used to search within a document for example.
Regex Syntax
In this article I will discuss one by one the characters used in regex to create patterns.
Delimiter/Limiter
The delimiter in a regex works for delimiters. Every regex pattern must have a start and end limit. characters used by the delimiter other than letters, numbers, slashes (/), and the space used for the delimiter. Delimiters also use signs like #, ~etc.
Character Classes
If interpreted in Indonesian are character classes. So, the meaning of character classes is a line or sequence of regex characters (can be one or more) that represent a character string being searched for.
Anchors
In Indonesian it means anchor, this character’s position is very influential on the regex pattern.
Quantifiers
This character is very helpful when faced with strings that have repeated combinations of letters or syllables.
Grouping
Grouping is represented by (). This character () will be considered one group, the advantage of grouping is that it can be combined with quantifiers.
Flags/modifiers
This character serves to set the whole pattern, these flags are located after the closing delimiter.
Escaped Characters
Characters like *^$ very functional in regex, so when you want to use the character in its original form then you have to use \ then follow with that character.
Hopefully with this article you can understand what a regex is and what characters are in it. You can learn more about regex by reading the article above. That’s all from my discussion, of course the above discussion is not complete enough. But I think it’s enough to give you an idea of what a regex is.