\d+
matches any positive number of digits within your string, so it matches the first 78
and succeeds.
Use ^\d+$
.
Or, even better: "78.46.92.168:8000".isdigit()
More Related Contents:
- Searching for IP addresses in a file
- How to understand regular expression with python?
- Escaping regex string
- Fast punctuation removal with pandas
- 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 replace only part of the match with python re.sub
- How to split by commas that are not within parentheses?
- Replace first occurrence of string in Python
- BeautifulSoup webscraping find_all( ): finding exact match
- 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?
- Re.match() returns always none
- How to use regular expression in lxml xpath?
- 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 does python and the regex module handle backslashes?
- How to tell if one regular expression matches a subset of another regular expression?
- Python: Replace with regex
- Remove non-ASCII characters from a string using python / django
- How to strip whitespace from before but not after punctuation in python
- re.split() gives empty elements in list