Nikitasha Shrivastava has Published 70 Articles

Extract decimal numbers from a string in Python

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 23-Apr-2025 12:50:17

13K+ Views

To extract decimal numbers from a string in Python, regular expressions are used. A regular expression is a group of characters that allows you to use a search pattern to find a string or a set of strings. RegEx is another name for regular expressions. The re module in Python ... Read More

How to write a case insensitive Python regular expression without re.compile?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 23-Apr-2025 12:42:47

14K+ Views

By default, Python regular expressions (regex) look for case-sensitive matches. That is, the terms "apple" and "Apple" are not synonyms. But sometimes we want to search without consideration for uppercase or lowercase. This is referred to as a case-insensitive match. This chapter teaches you how to create case-insensitive regexes in ... Read More

How does B regular expression work in Python?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 23-Apr-2025 12:38:24

712 Views

In this article, we will see the concept of B-regular expressions in Python. Regular expressions (regex) are a useful tool for matching patterns in strings. In Python, the re module helps you to work with regex patterns. What is a B Regular Expression? A 'B' regular expression is a type ... Read More

How does [d+] regular expression work in Python?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 23-Apr-2025 12:22:53

3K+ Views

Regular expressions are a useful tool for searching and manipulating strings in Python. Among the several patterns and methods available, the [d+] expression is used to match one or more digits in a string. In this article, we will go over the [d+] regular expression pattern, the way it ... Read More

What Python regular expression can be used in place of string.replace?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 23-Apr-2025 11:02:07

155 Views

In this article, we are going to discuss how to use regular expressions in place of a string.replace() method. As you may know, Python's built-in string.replace() method is used to replace given substrings in a string. But when we need more complex replacement features so Python's re (regular expressions) module is ... Read More

How to write Python regular expression to get zero or more occurrences within the pattern?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 23-Apr-2025 10:36:49

759 Views

In this article we will be using Regular Expression to get zero or more occurrences within the pattern. Regular expressions (regex) are important features to identify patterns in text. In Python, the re module provides support for working with regex. The concept of zero or more occurrences is a key ... Read More

How do we create Python String from list?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 17-Apr-2025 19:33:44

246 Views

In programming, it is very common to work with lists, which are collections of items. But sometimes, you may want to turn a list into a single string. So in this chapter, we will show you how you can do this in Python. We will use some simple explanations and ... Read More

How can we use Complex Numbers in Python?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 17-Apr-2025 19:24:06

350 Views

Complex numbers is the combination of both real and imaginary components. Sometimes they are written as a + bi, where - a is the real part or number, b is the imaginary part, i is the imaginary unit which is basically a square root of -1. The ... Read More

How would you make a comma-separated string from a list in Python?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 17-Apr-2025 19:21:29

56K+ Views

In Python, a list is an ordered sequence that can hold several object types, such as integers, characters, or floats. In other programming languages, a list is equivalent to an array. Square brackets [] are used to denote it, and a comma (, ) is used to divide two items ... Read More

How to get first 100 characters of the string in Python?

Nikitasha Shrivastava

Nikitasha Shrivastava

Updated on 17-Apr-2025 18:59:18

6K+ Views

As you may know a string is a group of letters, numbers, or symbols in Python. Sometimes we do not need the whole string. We may only want a small part of it. For example, we may want only the first 100 characters. Python makes this easy by using something ... Read More

Previous 1 ... 3 4 5 6 7
Advertisements