JavaScript RegExp \n MetacharacterThe regex "\n" shows the available new line in the input string in JavaScript. If the new line element is available, then the position of the values shows; otherwise "-1" value shows using the search method. We can test, search, and match the required string using this Metacharacter. SyntaxThe syntax is used to show new line elements of the input string. Description:
Supported BrowsersThe RegExp \n Metacharacter supports the following browsers supported using the javascript function:
ExamplesThe following examples use to search, match, test, and execute new line values using the "\n" regex metacharacter in javascript. Example 1The following example shows a test new line metacharacter of the regex in javascript. If the value is available, the test method shows true otherwise false. Output The output shows the non-word character of the string. Example 2The following example shows the position of the new line metacharacter of the regex in tttttttttt. If a new line value is unavailable, then "-1" shows as an output. Output The output shows the position of the new line of the string. Example 3The following example shows the position of the new line metacharacter of the regex in JavaScript. If a new line value is unavailable, then "null" is an output. Output The output shows the position of the new line of the string. Example 4The following example shows the available new line metacharacter of the regex in javascript. If a new line value is available, then the value is replaced with the required input. Output The output shows the replacement value of the new line in the string. ConclusionThe regular expression helps to find new lines in the information using JavaScript methods. The simple Metacharacter works to validate user-interactive data. Next TopicJavaScript \xxx RegExp Metacharacter |
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