JavaScript Regex Source PropertiesJavaScript regex source property helps to return the source code or format of the regular expression. We can get the regular expression pattern used for the operation and validation. SyntaxThe following syntax is used to get the regular expression's pattern. Supported BrowsersThe browsers supported by RegExp source properties are given below:
ExamplesThe following examples work for the types of the regex data and its value. Example 1: The example shows the regex regex pattern for the source property. Here, we use regex directly with the source keyword. Output The output shows the regex source code of the object function. Example 2: The example shows the array function regex pattern for the source property. Here, we use regex with start and end match values using the source keyword. Output The output shows the regex source code of the function. Example 3: The example shows the string regex pattern for the source property. Here, we use regex with the new keyword and method format. The source property does not display modifiers of the pattern. Output The output shows the regex source code of the function. Example 4: The example shows the number function regex pattern for the source property. We use the regex value with a modifier, but the source code does not show modifiers. Output The output shows the regex source code of the object function. Benefits
Disadvantages
ConclusionThe source property shows the regex code of JavaScript for complicated and lengthy operations. It helps developers to operate regex and its validation. |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India