Regex is a sequence of pattern that is used for matching with a pattern. While searching for data in a text, the search pattern is described for what we are searching for. It can be a single character or a more complex pattern. It can be used to perform all types of text searches. Regex has its own static and instance properties.
Example: A regular expression.
- gfg is a pattern (to be used in a search).
- g is a modifier (modifies the search to be case-insensitive).
The concatenation of Regex in the programming world can be understood as combining text patterns
to obtain a new text pattern, such as “Hello” + “World” is /HelloWorld/. Whenever RegExp() is called, it creates a new RegExp object.
Example 1: This example creating an expression without actually using the Regex literal syntax. This allows you to make arbitrary string manipulation before it becomes a Regex object.
Example 2: If you have two Regex literals, you can concatenate them using a technique where it removes duplicates, but keep the unique values in order, joining both the regex literals.
Example: /hello/y + / world/g would be /hello world/gy
- Ruby Literals
- Java Numeric Literals with Underscore
- Function to escape regex patterns before applied in PHP
- ES6 | RegEx
- Split a String into columns using regex in pandas DataFrame
- Python | Parse a website with regex and urllib
- Perl | Grouping and Alternation in Regex
- Perl | Anchors in Regex
- Perl | Assertions in Regex
- Perl | Extract IP Address from a String using Regex
- How to get YouTube video ID with PHP Regex ?
- What is Regex in Golang?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.