473,382 Members | 1,743 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,382 software developers and data experts.

redemo.py with named groups

Hi,
I wrote an easy patch for redemo.py to print named groups.

For example,

regexp: (?P<spam>.*)
string: foobar

shows following groups.

Groups:
0: 'foobar'
1: 'foobar'
'spam': 'foobar'

I don't know how/where to commit this patch..
any suggestions?

--- Tools/scripts/redemo.py 2004-02-13 02:35:32.000000000 +0900
+++ redemo.py 2006-08-21 01:11:11.000000000 +0900
@@ -148,6 +148,10 @@
for i in range(len(groups)):
g = "%2d: %r" % (i, groups[i])
self.grouplist.insert(END, g)
+ groupdict = m.groupdict()
+ for key in groupdict:
+ g = "%r: %r" % (key, groupdict[key])
+ self.grouplist.insert(END, g)
nmatches = nmatches + 1
if self.showvar.get() == "first":
break

Aug 21 '06 #1
0 1131

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

Similar topics

5
by: D Witherspoon | last post by:
I use the following code to open up a form. ------------------------------------------------------- If fImage Is Nothing Then fImage = New frmImage End If fImage.Show()
48
by: Adam Ruth | last post by:
Hello, Has there ever been any talk to adding named parameters to C? I enjoy using them in my Python and Ada code and can see their usefulness in C. I can envision an implementation where the...
4
by: Ben Dewey | last post by:
Hey, I have only been playing with regular expressions for some time. I am working on some code that parses and object 560 event log. I have created two expressions the first one which works...
7
by: Edgardo Rossetto | last post by:
Hi, I have something like: string result = null; try { string exp = @"(?'GroupName'<title>.*\(({4})\).*</title>)"; Regex r = new Regex(exp); result = r.Match(html).Groups.Value; return...
0
by: Laser Lu | last post by:
Hi, all, Does any body recognize \p{name} in Regular Expression? In MSDN, it says the \p{name} represents a named character class, the original description is as follows: "Matches any character...
1
by: Gary Wessle | last post by:
Hi I was reading the Regular Expression HowTo, it refers to redemo.py if you have Tkinter installed. a quick #locate redemo.py returned none on my debian/testing, however #locate Tkinter...
8
by: Paddy | last post by:
Proposal: Named RE variables ====================== The problem I have is that I am writing a 'good-enough' verilog tag extractor as a long regular expression (with the 'x' flag for...
5
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the...
5
by: Hugo Ferreira | last post by:
Hi! Is it possible to "automagically" coerce the named groups to python types? e.g.: <type 'str'> But what I'm looking forward is for the type to be 'int'. Cheers!
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.