473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

regular expression question (re module)

Hi,

I need to match a string of the form

capital_letter underscore capital_letter number

against a string of the form

anything capital_letter underscore capital_letter number
some_stuff_not_starting with a number

Eg D_A1 needs to match with DUKE00001_plateD_A1.CEL, but not any of
DUKE00001_plateD_A10.CEL, Duke00001_PlateD_A11v2.CEL,
DUKE00001_plateD_A12.CEL.

Similarly D_A10 needs to match DUKE00001_plateD_A10.CEL, but not any
of DUKE00001_plateD_A1.CEL, Duke00001_PlateD_A11v2.CEL,
DUKE00001_plateD_A12.CEL.

Similarly D_A11 needs to match Duke00001_PlateD_A11v2.CEL, but not any
of DUKE00001_plateD_A1.CEL, DUKE00001_plateD_A10.CEL,
DUKE00001_plateD_A12.CEL.

Thanks in advance. Please cc me with any reply.
Faheem.

Oct 11 '08 #1
4 814
Faheem Mitha:
I need to match a string of the form
...
Please, show the code you have written so far, with your input-output
examples included (as doctests, for example), and we can try to find
ways to help you remove the bugs you have.

Bye,
bearophile
Oct 11 '08 #2
Pat
Faheem Mitha wrote:
Hi,

I need to match a string of the form

capital_letter underscore capital_letter number

against a string of the form

anything capital_letter underscore capital_letter number
some_stuff_not_starting with a number
<snip>
DUKE00001_plateD_A12.CEL.

Thanks in advance. Please cc me with any reply.
Faheem.
While I can't provide you with an answer, I can say that I've been using
RegExBuddy (for Windows, about $40, 90 day money back guarantee,
http://www.regexbuddy.com/) for quite a few months now and it's greatly
helped me with creating/learning/debugging regexps. You put in your
regexp in the top field and all the possibilities in the bottom field.
Whatever matches is instantly highlighted. You keep modifying your RE
until only the correct matches are highlighted. Talk about instant
gratification! No, I'm in no way affiliated with this company.

There's also a free *IX version that's quite similar to RegExBuddy but I
don't have the name since I'm writing this while on a Windows platform.
Oct 16 '08 #3
Pat wrote:
Faheem Mitha wrote:
>Hi,

I need to match a string of the form

capital_letter underscore capital_letter number

against a string of the form

anything capital_letter underscore capital_letter number
some_stuff_not_starting with a number
<snip>
>DUKE00001_plateD_A12.CEL.

Thanks in advance. Please cc me with any reply.
Faheem.

While I can't provide you with an answer, I can say that I've been using
RegExBuddy (for Windows, about $40, 90 day money back guarantee,
http://www.regexbuddy.com/) for quite a few months now and it's greatly
helped me with creating/learning/debugging regexps. You put in your
regexp in the top field and all the possibilities in the bottom field.
Whatever matches is instantly highlighted. You keep modifying your RE
until only the correct matches are highlighted. Talk about instant
gratification! No, I'm in no way affiliated with this company.

There's also a free *IX version that's quite similar to RegExBuddy but I
don't have the name since I'm writing this while on a Windows platform.
--
http://mail.python.org/mailman/listinfo/python-list
Or you could use the Kodos tool, written in Python and well worth a
trial since it's free. Google is, as always, your friend in locating it.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Oct 17 '08 #4

On Oct 16, 2008, at 11:25 PM, Steve Holden wrote:
Pat wrote:
>Faheem Mitha wrote:
>>Hi,

I need to match a string of the form

capital_letter underscore capital_letter number

against a string of the form

anything capital_letter underscore capital_letter number
some_stuff_not_starting with a number
<snip>
>>DUKE00001_plateD_A12.CEL.

Thanks in advance. Please cc me with any reply.

Faheem.

While I can't provide you with an answer, I can say that I've been
using
RegExBuddy (for Windows, about $40, 90 day money back guarantee,
http://www.regexbuddy.com/) for quite a few months now and it's
greatly
helped me with creating/learning/debugging regexps. You put in your
regexp in the top field and all the possibilities in the bottom
field.
Whatever matches is instantly highlighted. You keep modifying your
RE
until only the correct matches are highlighted. Talk about instant
gratification! No, I'm in no way affiliated with this company.

There's also a free *IX version that's quite similar to RegExBuddy
but I
don't have the name since I'm writing this while on a Windows
platform.
--
http://mail.python.org/mailman/listinfo/python-list
Or you could use the Kodos tool, written in Python and well worth a
trial since it's free. Google is, as always, your friend in locating
it.

I use this one as my regex playground:
http://cthedot.de/retest/


Oct 17 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Danny | last post by:
I am trying to do a regular expression to search for a url so anything that has http:\\www.hellothere.com but may not have the http:\\ and may not have the www and may not have http:\\www and...
5
by: Meisam Ganjeali | last post by:
hi all how can i use regular expression in c and how can i strip html tags from one string with c. thanks.
6
by: JohnSouth | last post by:
Hi I've been using a Regular expression to test for valid email addresses. It looks like: \w+(\w+)*@\w+(\w+)*\.\w+(\w+)* I've now had 2 occassions where it has rejected and email address...
3
by: Lisa Bogart | last post by:
I am trying to take a string and parse it out into multiple strings based on a pattern but am stuck and am hoping someone can give me a clue. My pattern looks like so: sMatch =...
19
by: Davy | last post by:
Hi all, I am a C/C++/Perl user and want to switch to Python (I found Python is more similar to C). Does Python support robust regular expression like Perl? And Python and Perl's File...
11
by: Steve | last post by:
Hi All, I'm having a tough time converting the following regex.compile patterns into the new re.compile format. There is also a differences in the regsub.sub() vs. re.sub() Could anyone lend...
1
by: Wehrdamned | last post by:
Hi, As I understand it, python uses a pcre engine to work with regular expression. My question is, then, why expressions like : Traceback (most recent call last): File "<stdin>", line 1, in...
20
by: Asper Faner | last post by:
I seem to always have hard time understaing how this regular expression works, especially how on earth do people bring it up as part of computer programming language. Natural language processing...
5
by: Noah Hoffman | last post by:
I have been trying to write a regular expression that identifies a block of text enclosed by (potentially nested) parentheses. I've found solutions using other regular expression engines (for...
8
by: metaperl.com | last post by:
Pyparsing has a really nice feature that I want in PLY. I want to specify a list of strings and have them converted to a regular expression. A Perl module which does an aggressively optimizing...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.