Supposing you want to be able to match *.swiss.ch
domains and addresses:
import re
preg = re.compile(r'([^\.]+)\.swiss\.ch')
More Related Contents:
- How can I remove text within parentheses with a regex?
- Regexp finding longest common prefix of two strings
- Searching for IP addresses in a file
- In Python, how do I split a string and keep the separators?
- Is there a simple way to remove multiple spaces in a string?
- Split string on whitespace in Python [duplicate]
- Regular expression to match a dot
- Python non-greedy regexes
- Python and regular expression with Unicode
- Match text between two strings with regular expression
- Regex to extract URLs from href attribute in HTML with Python [duplicate]
- How to split by commas that are not within parentheses?
- Replace first occurrence of string in Python
- BeautifulSoup webscraping find_all( ): finding exact match
- In Python, how to check if a string only contains certain characters?
- How to handle response encoding from urllib.request.urlopen() , to avoid TypeError: can’t use a string pattern on a bytes-like object
- Regex: AttributeError: ‘NoneType’ object has no attribute ‘groups’
- remove unicode emoji using re in python
- Python – RegEx for splitting text into sentences (sentence-tokenizing) [duplicate]
- Python regex string matching?
- What are the differences between Perl, Python, AWK and sed? [closed]
- replacing only single instances of a character with python regexp
- Why isn’t the regular expression’s “non-capturing” group working?
- Python Regular Expression Match All 5 Digit Numbers but None Larger
- Python regular expression for HTML parsing
- Remove Sub String by using Python
- Type of compiled regex object in python
- How to tell if one regular expression matches a subset of another regular expression?
- re.split() gives empty elements in list
- Issue with regex backreference in Python