- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 a word in python using Regular Expression?
The following code matches the word ‘meeting’ in the given string.
It uses positive look-ahead and look-behind assertions to respect enclosing characters but without including them in the match.
Example
import re s = """http://www.google.com/meeting_agenda_minutes.html""" result = re.findall(r'(?<=[\W_])meeting(?=[\W_])', s) print result
output
['meeting']
- Related Articles
- How to match a whitespace in python using Regular Expression?
- How to match a nonwhitespace character in python using Regular Expression?
- How to match a single character in python using Regular Expression?
- How to match nonword characters in Python using Regular Expression?
- How to match only digits in Python using Regular Expression?
- How to match only non-digits in Python using Regular Expression?
- How to match parentheses in Python regular expression?
- How to match any one lowercase vowel in python using Regular Expression?
- How to match any one uppercase character in python using Regular Expression?
- How to match any non-digit character in Python using Regular Expression?
- How to match at the beginning of string in python using Regular Expression?
- How to match at the end of string in python using Regular Expression?
- How to match digits using Java Regular Expression (RegEx)
- PHP – Match regular expression using mb_ereg_match()
- Java Regular Expression to match a line that doesn't contain a word.

Advertisements