472,378 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 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 783
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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.