

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to match at the end of string in python using Regular Expression?
The following code matches the word 'stadium' at the end of the string ' cheer leaders at the football stadium'
$-matches the end of the string
Example
import re s = 'cheer leaders at the football stadium' result = re.search(r'\w+$', s) print result.group()
Output
This gives the output
stadium
- Related Questions & Answers
- How to match at the beginning of string in python using Regular Expression?
- How to match a word in python using Regular Expression?
- How to match nonword characters in Python using Regular Expression?
- How to match a whitespace in python using Regular Expression?
- How to match only digits in Python using Regular Expression?
- How to match text at the start or end of a string in Python?
- How to match parentheses in Python regular expression?
- How to match a regular expression against a string?
- How to match a single character in python using Regular Expression?
- How to match a nonwhitespace character in python using Regular Expression?
- How to match only non-digits in Python using Regular Expression?
- Match any string with p at the end of it.
- How do we use Python regular expression to match a date string?
- How to match digits using Java Regular Expression (RegEx)
- How to match any one lowercase vowel in python using Regular Expression?
Advertisements