Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Found 445 Articles for Programming Scripts

How to perform Multiline matching with JavaScript RegExp?

Moumita
Updated on 23-Jun-2020 07:32:31

632 Views

To perform multiline matching, use the M modifier available in JavaScript Regular Expression.ExampleYou can try to run the following code to perform multiline matching −           JavaScript Regular Expression                        var myStr = "Welcoming!";          var reg = /^ing/m;          var match = myStr.match(reg);                    document.write(match);          

Which is the JavaScript RegExp to find any alternative text?

Nikitha N
Updated on 23-Jun-2020 07:32:05

202 Views

To match any of the specified alternatives, follow the below-given pattern −(foo|bar|baz)ExampleYou can try to run the following code to find any alternative text −           JavaScript Regular Expression                        var myStr = "one,one,one, two, three, four, four";          var reg = /(one|two|three)/g;          var match = myStr.match(reg);          document.write(match);          

How to perform Case Insensitive matching with JavaScript RegExp?

Shubham Vora
Updated on 15-Sep-2022 12:18:08

4K+ Views

In this tutorial, we will learn how to perform Case Insensitive matching with JavaScript RegExp. Regular expressions can be declared in two ways − Using regular expressions literal, which start and end with slashes, and the pattern is placed in between. Calling the RegExp object constructor, which takes the pattern and flags in the parameters to create a regular expression. Users can use the below syntax to create a regular expression. Syntax //Using a regular expression literal const regex = /tutorial/i //Using RegExp constructor const regex2 = new RegExp('tutorial', 'i') In the above syntax, the regular expressions ... Read More

Find digits between brackets in JavaScript RegExp?

Sravani Alamanda
Updated on 26-Aug-2022 13:09:37

770 Views

In this tutorial, we learn how to find the digits between brackets using JavaScript RegExp. The ASCII values for the digits (0-9) start from 48 to 57. We denote the digits in the bracket as [0-9] in the regular expression. To find the digits in a range except for all digits, we can write the particular range. As to find the digits between 4 and 8, we could write it as [4-8] in the regular expression pattern. Now, our aim is to find digits inside the brackets in the text using RegExp in JavaScript. We could follow the below syntaxes ... Read More

With JavaScript DOM delete rows in a table?

Sharon Christine
Updated on 23-Jun-2020 07:33:28

6K+ Views

To delete rows in a table in JavaScript, use the DOM deleteRow() method.ExampleYou can try to run the following code to learn how to delete rows in a table. The code deletes rows one at a time −Live Demo                 function captionFunc(x) {          document.getElementById(x).createCaption().innerHTML = "Demo Caption";       }                                           One             Two                                 Three             Four                                 Five             Six                                                                

How can I show image rollover with a mouse event in JavaScript?

Shubham Vora
Updated on 14-Jul-2022 12:35:00

9K+ Views

This tutorial will teach us to show image rollover with a mouse event in JavaScript. The meaning of the image rollover is to either change the image style or the whole image when the user rollovers the mouse on the image.To build an attractive user interface, developers often add image rollover features to the website and applications. Here, we will see to apply image rollover differently.Change the style of the image on mouse rolloverIn this method, to create the image rollover, we will use the onmouseover and onmouseout event of JavaScript. When users take the mouse pointer on the image, ... Read More

How to create a table caption with JavaScript DOM?

Jai Janardhan
Updated on 23-Jun-2020 07:32:58

516 Views

To create a table caption, use the DOM createCaption() method.ExampleYou can try to run the following code to learn how to create table caption −Live Demo                    function captionFunc(x) {             document.getElementById(x).createCaption().innerHTML = "Demo Caption";          }                                           One             Two                                 Three             Four                                 Five             Six                                          

How can I simplify the usage of Regular Expressions with JavaScript?

Shubham Vora
Updated on 14-Jul-2022 12:52:25

274 Views

In this tutorial, we will learn to simplify the use of regular expressions in JavaScript. Some of you have heard the regular expression word for the first time. So, it is not related to JavaScript but can be used in any programming language.The simple definition of the regular expression is that it is a sequence of the characters, also called Regex or RegExp. It can be a small or complex sequence.Let’s understand the need for regular expression by the example in the below section.Why should we use regular expressions?Suppose that you are developing the application and you need to take ... Read More

How to get the innerHTML of a cell with JavaScript DOM?

Shubham Vora
Updated on 12-Oct-2022 09:01:26

8K+ Views

In this tutorial, we will learn how to get the innerHTML of a cell with JavaScript DOM. Use the innerHTML property in JavaScript to get the innerHTML of a cell. We can manipulate the DOM (Document Object Model) easily using document.getElementById(). It is a method that returns the element object that represents the id of the element whose id is mentioned in the method’s parameter. Since every tag’s id is unique, we can easily access the element by its id. Then the innerHTML property will help to access the text or content of that tag Using Table cells Collection To ... Read More

How to write a script to access document properties using IE4 DOM method?

Smita Kapse
Updated on 23-Jun-2020 07:27:28

133 Views

This IE4 document object model (DOM) introduced in Version 4 of Microsoft's Internet Explorer browser. IE 5 and later versions include support for most basic W3C DOM features.ExampleTo access document properties using IE4 DOM method, try to run the following code −           Document Title                                     This is main title       Click the following to see the result:                                                                

Advertisements