How to write Python Regular Expression find repeating digits in a number?

Nikitasha Shrivastava
Updated on 06-Jun-2025 14:58:23

850 Views

In this article you will find to write regular expression in Python to find repeating digits in the given number. Regular expression is a special feature that helps you find matching parts of a string. It can find all repeated characters or digits in a number. Finding repeating digits can help in many areas like data analysis or validation. For example, check if a number like 1223 has repeated digits "2" or "3". So in this example 2 is the repeated digit. Let us see how you can perform this task practically using Python Regex. Regex Pattern for Repeated Digits ... Read More

How to escape all special characters for regex in Python?

Nikitasha Shrivastava
Updated on 06-Jun-2025 14:51:01

2K+ Views

This article will discuss how to escape all the special characters for regular expressions in Python. So when you work with regular expressions in Python, some characters have special meanings like *, ., +, ?, (, ), etc. These characters are special characters in regular expressions. If you want to look for them as plain text, you can escape them. Python provides a special function to do this task, which is the re.escape() function. The re.escape() function automatically adds a backslash \ before each special character in the given string. By using it, we can make the string safe to ... Read More

Java program to check the birthday and print happy birthday message

Alshifa Hasnain
Updated on 06-Jun-2025 14:50:13

3K+ Views

In this article, we will understand how to check the birthday and print Happy Birthday message. Checking the birthday is achieved by comparing the present day and the given birthday. Problem Statement Write a program that checks if today's date matches a predefined birthday date. If the dates match, the program should print a "Happy Birthday" message otherwise, it should indicate that today is not the birthday. Below is a demonstration of the same − Input Birthday Date: 15 July Output Today’s Date is 20-12-2021 Today is not my birthday Different ways to check the birthday ... Read More

How to implement the Fibonacci series in JShell in Java 9?

Alshifa Hasnain
Updated on 06-Jun-2025 14:44:13

191 Views

In this article, we will learn to implement the Fibonacci series in JShell in Java 9. First, we will learn how the Fibonacci series works, then learn two approaches(iterative and recursive) to implement this sequence in the JShell environment. JShell JShell is a Java shell tool introduced in Java 9 that allows us to execute Java code and print the result immediately. It is a REPL (Read-Evaluate-Print-Loop) tool that runs from the command-line prompt. What is a Fibonacci Series? A number is said to be in the Fibonacci series if each subsequent number is the sum of the previous two ... Read More

What is difference between '.' , '?' and '*' in Python regular expression?

Nikitasha Shrivastava
Updated on 06-Jun-2025 14:40:28

471 Views

This article will discuss the difference between dot '.', question mark '?', and asterisk'*' in Python regular expressions. In regular expressions, '.' means any one character except the newline, '*' means zero or more times of the character or group before it. and '?' means zero or one time of the character or group before it. In some types of regex, ? Also makes things non-greedy. As we have seen in Python regular expressions, these symbols have different meanings, so let us understand these symbols using the examples - Usage of Dot (.) The following example will use ... Read More

Java Program to Create Pyramid and Pattern

Alshifa Hasnain
Updated on 06-Jun-2025 14:37:45

3K+ Views

In this article, we will learn to create pyramid patterns using Java. It will help us to understand how loops work.  for loop while loop Java program to create pyramid patterns We are going to print the following pyramid patterns:  Half Star Pyramid Inverted Half Star Pyramid Star Pyramid Inverted Star Pyramid Numeric Pyramid Pattern 1: Half Star Pyramid We will initialize the row to 5 and a loop runs from i-1 to i

Stringize and Token-pasting operator in C

Aman Kumar
Updated on 06-Jun-2025 14:18:52

3K+ Views

In this article we will see what are the Stringize operator and Token Pasting operator in C. The stringize operator (#) and the token pasting operator (##) are preprocessor operators used within macros for text manipulation. It sends commands to compiler to convert a token into string. Stringize Operator (#) The stringize operator (#) is a preprocessor operator that converts the micros parameter into a string literal. The preprocessor encloses the actual argument passed to the macro in double quotes, effectively convert it into a string. Syntax Following is the syntax of Stringize Operator: #define MACRO_NAME(arg) #arg ExampleIn ... Read More

StringStream in C++ for Decimal to Hexadecimal and back

Aman Kumar
Updated on 06-Jun-2025 14:18:31

907 Views

In this article, we will see how to convert a Decimal to a Hexadecimal string and versa in C++. For this conversion, we are using the string stream feature of C++. You can use StringStreams for formatting, parsing, converting a string into numeric values, and more. The Hex is an I/O manipulator. It takes a reference to an I/O stream as a parameter and returns a reference to the string after manipulating it. Implementation of converting Decimal to Hexadecimal In the following example, we will see how to convert decimal numbers or hexadecimal numbers in C++. #include #include ... Read More

Stack Unwinding in C++

Aman Kumar
Updated on 06-Jun-2025 14:11:37

2K+ Views

When we call some functions, the call stack stores the address, and after returning, it pops the address to resume work. What is Stack Unwinding Stack unwinding refers to the process of removing function call frames from the function call stack during runtime, wherein local objects are destroyed in the reverse order of their construction. Why Stack Unwinding Occurs? Stack unwinding occurs when an exception occurs in a function and is not handled immediately in that function. The program control goes back through each function step by step, cleaning up any temporary resources used by each function. How Unwinding Works? ... Read More

What happen if we concatenate two string literals in C++?

Aman Kumar
Updated on 06-Jun-2025 14:10:58

158 Views

In this article, we will explore what happens when we concatenate two string literals in C++. There are two important points to remember when concatenating strings in C++. Concatenation is another property of the string and string literals: let's see the following two properties below: If x + y is the expression of string concatenation, where x and y are both strings. Then the result of this expression will be a copy of the characters of string x followed by the characters of string y. Either x or y can be ... Read More

Advertisements