Solved

Phyton Regular Expression help, pls

Posted on 2008-10-09
1
202 Views
Last Modified: 2010-04-16
Need help writing a regular expression:

I need a regexp to match a URL, so I need to include all URLs that have a 'hello' in them and exclude all URLs that have 'bye' in them, in other words,
need a regexp that matches .*hello.* but does not match .*bye.*

NOTE: I replaced the super-secret  words with 'hello' and 'bye' ;)
I promise this is not a homework, I just suck with Regular Expressions and could not find online the exclude pattern
Thanks!
0
Comment
Question by:Gula
1 Comment
 
LVL 1

Accepted Solution

by:
Gula earned 0 total points
ID: 22681681
.*hello(?!.*bye.*)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will show the steps for installing Python on Ubuntu Operating System. I have created a virtual machine with Ubuntu Operating system 8.10 and this installing process also works with upgraded version of Ubuntu OS. For installing Py…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now