Difference Between re.search and re.findall Methods in Python Regular Expressions

Rajendra Dharmkar
Updated on 13-Jun-2020 06:35:06

1K+ Views

The re.search() method is similar to re.match() but it doesn’t limit us to find matches at the beginning of the string only. Exampleimport re result = re.search(r'Tutorials', 'TP Tutorials Point TP') print result.group()OutputTutorialsHere you can see that, search() method is able to find a pattern from any position of the string.The re.findall() helps to get a list of all matching patterns. It searches from start or end of the given string. If we use method findall to search for a pattern in a given string it will return all occurrences of the pattern. While searching a pattern, it is recommended to ... Read More

Declare Variables in JavaScript

Rahul Sharma
Updated on 13-Jun-2020 06:32:51

1K+ Views

Like many other programming languages, JavaScript has variables. Variables can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container.Before you use a variable in a JavaScript program, you must declare it. Variables are declared with the var keyword as follows.     You can also declare multiple variables with the same var keyword as follows −     Storing a value in a variable is called variable initialization. You can do variable initialization at the time of variable creation or at a later point in ... Read More

Where to Place the Google Analytics Tracking Code

Johar Ali
Updated on 13-Jun-2020 06:27:36

123 Views

When integrating your website with Google Analytics, add the Tracking Code in your code. This will allow Google Analytics to track the page views and provide other analytics.Copy the code and place it just before closing tag i.e. in your website code. When you will integrate, the following steps and the tracking code will be visible. This shows how and where to add the tracking code −

Place JavaScript in External Files

Amit Sharma
Updated on 13-Jun-2020 06:21:49

352 Views

To place JavaScript in external file create an external JavaScript file with the extension .js. After creating, add it to the HTML file in the script tag. The src attribute is used to include that external JavaScript file.If you have more than one external JavaScript file, then add it to the same web page to increase the performance of the page.Let’s say the following new.js is our external JavaScript file −function display() {    alert("Hello World!"); }Now add the external JavaScript file to the HTML web page −                                      

What Does Mean in a Python Regular Expression

Rajendra Dharmkar
Updated on 13-Jun-2020 06:20:09

2K+ Views

Non capturing groupsIf  we do not want a group to capture its match, we can write this regular expression as Set(?:Value). The question mark and the colon after the opening parenthesis are the syntax that creates a non-capturing group. The regex Set(Value)? matches Set or SetValue. In the first case, the first (and only) capturing group remains empty. In the second case, the first capturing group matches Value. The question mark appearing at the end is the quantifier that makes the previous token optional. Set(?:Value) matches Setxxxxx, i.e., all those strings starting with Set but not followed by Value. Such would be ... Read More

Difference Between Anonymous and Inline Functions in JavaScript

Rahul Sharma
Updated on 13-Jun-2020 06:18:52

2K+ Views

Anonymous FunctionsAnonymous, as the name suggests, allows creating a function without any names identifier. It can be used as an argument to other functions. This is how JavaScript anonymous functions can be used −var myfunc = function() {    alert(‘This is anonymous'); }Another example can be the following −setTimeout(function() {    alert('Demo'); }, 3000);Inline FunctionsAn inline function is a javascript function, which is assigned to a variable created at runtime. You can difference Inline Functions easily with Anonymous since an inline function is assigned to a variable and can be easily reused.This is how JavaScript inline functions can be used −var ... Read More

Write JavaScript in an External File

Amit Sharma
Updated on 13-Jun-2020 06:16:27

8K+ Views

Create external JavaScript file with the extension .js. After creating, add it to the HTML file in the script tag. The src attribute is used to include that external JavaScript file.If you have more than one external JavaScript file, then add it in the same web page to increase performance of the page.Let’s say the following new.js is our external JavaScript file −function display() {    alert("Hello World!"); }Now add the external JavaScript file to the HTML web page −                                      

Should I Always Put My JavaScript File in the Head Tag of My HTML File?

Ali
Ali
Updated on 13-Jun-2020 06:14:47

441 Views

You can place the tags, containing your JavaScript, anywhere within your web page, but it is normally recommended that you should keep it within the tag or tag.It’s good for performance to add JavaScript in element. Here’s an example to add under … −                               Here’s an example to add under … −                                        

Why Prefer to Put JavaScript in the Footer of an HTML Page

Rahul Sharma
Updated on 13-Jun-2020 06:13:45

901 Views

With JavaScript, you can put JavaScript anywhere on the page, whether inside or tag. But, it is a good practice to add JavaScript in the footer i.e. just before closing the tag. This is because −It loads script faster.It will not block any DOM content to load.It loads the web page before loading JavaScriptImproves display speedPage loads faster

Change User Settings for Case Sensitivity in SAP 6.0

Giri Raju
Updated on 13-Jun-2020 06:11:30

726 Views

Yes, there are user specific text settings which can let you stroke in Uppercase or lowercase whatever is you choice. Go to ABAP Editor initial screen using T-Code: SE38You need to go settings under utilities tab. With utilities select ABAP editor tab. Once you have selected ABAP editor tab, select pretty printer section. You will have a handful of options to choose from.

Advertisements