Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

regex

Remove all special characters, punctuation and spaces from string

August 19, 2022 by Magenaut

I need to remove all special characters, punctuation and spaces from a string so that I only have letters and numbers.

Categories Python, Q&A Tags python, regex, string Leave a comment

How can I remove text within parentheses with a regex?

August 19, 2022 by Magenaut

I’m trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I’m trying to remove text inside parentheses. For example:

Categories Python, Q&A Tags perl, python, regex Leave a comment

Split a string at uppercase letters

August 19, 2022 by Magenaut

What is the pythonic way to split a string before the occurrences of a given set of characters?

Categories Python, Q&A Tags python, regex, string Leave a comment

How to split but ignore separators in quoted strings, in python?

August 19, 2022 by Magenaut

I need to split a string like this, on semicolons. But I don’t want to split on semicolons that are inside of a string (‘ or “). I’m not parsing a file; just a simple string with no line breaks.

Categories Python, Q&A Tags python, regex Leave a comment

Regex to extract URLs from href attribute in HTML with Python

August 19, 2022 by Magenaut

Possible Duplicate:
What is the best regular expression to check if a string is a valid URL?

Categories Python, Q&A Tags python, regex, url Leave a comment

Regex matching 5-digit substrings not enclosed with digits

August 19, 2022 by Magenaut

I want to extract 5 continuous digits from the string

Categories Python, Q&A Tags python, regex Leave a comment

How can I do multiple substitutions using regex?

August 19, 2022 by Magenaut

I can use this code below to create a new file with the substitution of a with aa using regular expressions.

Categories Python, Q&A Tags python, regex, string Leave a comment

How to replace only part of the match with python re.sub

August 18, 2022 by Magenaut

I need to match two cases by one reg expression and do replacement

Categories Python, Q&A Tags python, regex Leave a comment

Recursive pattern in regex

August 18, 2022 by Magenaut

This is very much related to Regular Expression to match outer brackets however, I specifically want to know how or whether it’s possible to do this regex’s recursive pattern? I’m yet to find a python example using this strategy so think this ought to be a useful question!

Categories Python, Q&A Tags python, recursive-regex, regex Leave a comment

Python regex match OR operator

August 18, 2022 by Magenaut

I’m trying to match time formats in AM or PM.

Categories Python, Q&A Tags python, regex, string, time Leave a comment
Older posts
Newer posts
← Previous Page1 … Page10 Page11 Page12 … Page20 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress