![regular expression not start with regular expression not start with](https://miro.medium.com/max/684/1*Q70da0n7q90b5x4d6Df8-w.png)
IP Address is \d\.(1|254)$ Match Multiple IP Addresses with Regex OR Match Multiple URLs with Regex ORĪnother useful usage of the regex OR is matching multiple web site domain names or URLs. We added $ in order to prevent to match IP addresses like 12 19 etc. We will use the following regular expression which will match the IP address those ends with 1 or 254. Regex OR is very useful in order to match multiple IP addresses. I live in (Turkey|England|Usa|Germany)$ Limit Regex OR with Line End Match Multiple IP Addresses with Regex OR We will use the following regular expression. If we want to limit the end of the regex and be sure that the line ends we can add $ at the end of the regular expression. Regular expression targets only provided regular expression and do not check previous or after characters. Let’s examine why they match or not match. I live in (Turkey|England|Usa|Germany) Match Complete Sentence By Using Regex OR In the following example, we want to match all sentences those start with I live in and end one of the countries Turkey, England, Usa, Germany. We will provide the static part of the sentence and then add the OR part where multiple values can be used. But we will match the complete sentence by using Regex OR operand. This example is very similar to the previous one. Match Complete Sentence By Using Regex OR Actually all of them refer to the same thing which is |and this symbol is used to delimit the regex OR values from each other. I live in China Regex OR Alternation Match Example Vertical Bar or Pipe Symbol or Alternation Operandīefore diving into more complex examples we need to explain the terms Vertical Bar, Pipe Symbol and Alternation Operand. (Turkey|England|Usa|Germany)īut will not match with the following sentences. We will also use parenthesis for grouping the OR values. We will use the pipe or vertical bar or alternation operator those are the same | to provide OR logic like below. If we want to OR the given values all of them will match with the following sentences. Examples: With two parameters: Function will assume to start from beginning of the string and return first matched occurrence. Let’s start with a simple example like we want to match one of the following values. Syntax: REGEXPSUBSTR(source string, regular expression string ,start from position number, nth occurrence, match argument ) Note: This function supports 2, 3, 4, or 5 parameters. Regex “OR” LogicĪs stated previously OR logic is used to provide alternation from the given multiple choices. In this tutorial, we will explain what is Regex OR logic and how can we implement Regex OR in different programming languages like JavaScript, Python, C#, and Java. OR is a logic term used to provide selection choice from multiple choices. A regular expression is a formation in order to match different text or words or numbers according to the given regex pattern.