Python re.sub Examples
result = re.sub("(\d+) (\w+)", r"\2 \1")
result = re.sub("(?<number>\d+) (?<word>\w+)", r"\g<word> \g<number>")
Python re.sub Examples
result = re.sub("(\d+) (\w+)", r"\2 \1")
result = re.sub("(?<number>\d+) (?<word>\w+)", r"\g<word> \g<number>")
Python re.sub Examples
result = re.sub('abc', '', input) # Delete pattern abc
result = re.sub('abc', 'def', input) # Replace pattern abc -> def
result = re.sub(r'\s+', ' ', input) # Eliminate duplicate whitespaces using wildcards
result = re.sub('abc(def)ghi', r'\1', input) # Replace a string with a part of itself
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us