DeveloperBreeze

Regular Expressions Development Tutorials, Guides & Insights

Unlock 3+ expert-curated regular expressions tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your regular expressions skills on DeveloperBreeze.

Understanding Regular Expressions with `re` in Python

Tutorial October 24, 2024
python

  • This pattern efficiently extracts all numeric values from a string, whether they are positive or negative, whole numbers or floating points.

In this tutorial, we explored various examples of how to use regular expressions in Python to extract signed and unsigned integers, floating-point numbers, and a mix of both. By modifying the regex pattern slightly, you can adjust it to match exactly what you need in your specific application.

Python Regular Expressions (Regex) Cheatsheet

Cheatsheet August 03, 2024
python

pattern = re.compile(r'\d+')
match = re.search(r'\d+', 'The price is 100 dollars')
if match:
    print(match.group())  # Output: 100

match = re.match(r'\d+', '123 apples')
if match:
    print(match.group())  # Output: 123

match = re.fullmatch(r'\d+', '12345')
if match:
    print(match.group())  # Output: 12345

Validate Password Strength

Code January 26, 2024
javascript

// Function to check if a password meets certain strength criteria
function isValidPassword(password) {
    // Customize validation rules as needed
    const minLength = 8;
    const hasUppercase = /[A-Z]/.test(password);
    const hasLowercase = /[a-z]/.test(password);
    const hasDigit = /\d/.test(password);

    // Check if the password meets the criteria
    return password.length >= minLength && hasUppercase && hasLowercase && hasDigit;
}

// Example password
const password = 'SecurePwd123';

// Log whether the password is valid to the console
console.log('Is Valid Password:', isValidPassword(password));