About 69 results
Open links in new tab
  1. python .replace() regex - Stack Overflow

    python .replace() regex [duplicate] Ask Question Asked 12 years, 9 months ago. Modified 2 years, 3 months ago.

  2. regex - Python string.replace regular expression - Stack Overflow

    I want to replace one parameter's parameter-value with a new value. I am using a line replace function posted previously to replace the line which uses Python's string.replace(pattern, sub). …

  3. Regex replace (in Python) - a simpler way? - Stack Overflow

    If you can, try to tokenize data in this situation (break it into smaller parts based on regex rules) beforehand and replace based on these as this is more likely to be easier to accomplish the …

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

    @Amber: I infer from your answer that unlike str.replace(), we can't use variables a) in raw strings; or b) as an argument to re.sub; or c) both. a) makes sense (I think) but I'm not sure …

  5. python - How can I replace all occurrences of a substring using …

    Oct 12, 2016 · To further add to the above, the code below shows you how to replace multiple words at once! I've used this to replace 165,000 words in 1 step!! Note \b means no sub string …

  6. python - How to input a regex in string.replace? - Stack Overflow

    Python Regex String Replace. 1. Python regex replace string. 1. Python regular expression replace string ...

  7. python - re.sub replace with matched content - Stack Overflow

    A backreference to the whole match value is \g<0>, see re.sub documentation:. The backreference \g<0> substitutes in the entire substring matched by the RE.

  8. Python Regex instantly replace groups - Stack Overflow

    This is Python's regex substitution (replace) function. The replacement string can be filled with so-called backreferences (backslash, group number) which are replaced with what was matched …

  9. python - Replace strings in a file using regular expressions - Stack ...

    Feb 6, 2021 · How can I replace strings in a file with using regular expressions in Python? I want to open a file in which I should replace strings for other strings and we need to use regular …

  10. python regex to replace all windows newlines with spaces

    Jun 29, 2011 · If you want it to work regardless of the character order, you need to put the regex in square brackets: re.sub(r"[\r\n]+", " ", html). Otherwise the regex in above answer is just as …

Refresh