Re: Where can i reference the regular expressions

2010-03-24 Thread Andre Engels
? the is name Second, get a charactor in each word and compose like format {'t','h','e'} for a in line Most import is learning the regular expressions var this example. Okay, then I'll go into that part. regex = re.compile(line([^]*)/line) [^] here means any character but or * means that we have any

Large regular expressions

2010-03-15 Thread Nathan Harmston
Hi, So I m trying to use a very large regular expression, basically I have a list of items I want to find in text, its kind of a conjunction of two regular expressions and a big list..not pretty. However everytime I try to run my code I get this exception: OverflowError: regular expression

Re: Large regular expressions

2010-03-15 Thread Stefan Behnel
Nathan Harmston, 15.03.2010 13:21: So I m trying to use a very large regular expression, basically I have a list of items I want to find in text, its kind of a conjunction of two regular expressions and a big list..not pretty. However everytime I try to run my code I get this exception

Re: Large regular expressions

2010-03-15 Thread Alain Ketterlin
Nathan Harmston iwanttobeabad...@googlemail.com writes: [...] Could anyone suggest other methods of these kind of string matching in Python? I m trying to see if my swigged alphabet trie is faster than whats possible in Python! Since you mention using a trie, I guess it's just a big

Re: Large regular expressions

2010-03-15 Thread MRAB
Nathan Harmston wrote: Hi, So I m trying to use a very large regular expression, basically I have a list of items I want to find in text, its kind of a conjunction of two regular expressions and a big list..not pretty. However everytime I try to run my code I get this exception

Re: WANTED: Regular expressions for breaking TeX/LaTeX document into tokens

2010-02-26 Thread Jonathan Fine
Wes James wrote: On Wed, Feb 24, 2010 at 5:03 AM, Jonathan Fine j.f...@open.ac.uk wrote: Hi Does anyone know of a collection of regular expressions that will break a TeX/LaTeX document into tokens? Assume that there is no verbatim or other category code changes. I'm not sure how this does

WANTED: Regular expressions for breaking TeX/LaTeX document into tokens

2010-02-24 Thread Jonathan Fine
Hi Does anyone know of a collection of regular expressions that will break a TeX/LaTeX document into tokens? Assume that there is no verbatim or other category code changes. Thanks Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: WANTED: Regular expressions for breaking TeX/LaTeX document into tokens

2010-02-24 Thread Wes James
On Wed, Feb 24, 2010 at 5:03 AM, Jonathan Fine j.f...@open.ac.uk wrote: Hi Does anyone know of a collection of regular expressions that will break a TeX/LaTeX document into tokens?  Assume that there is no verbatim or other category code changes. I'm not sure how this does it, but it might

re.sub question (regular expressions)

2009-10-16 Thread Chris Seberino
What does this line do?... input_ = re.sub(([a-zA-Z]+), '\\1', input_) Does it remove parentheses from words? e.g. (foo) - foo ??? I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words, re.sub((\w+), '\\1', input_) blows up. Why? cs --

Re: re.sub question (regular expressions)

2009-10-16 Thread Jean-Michel Pichavant
Chris Seberino wrote: What does this line do?... input_ = re.sub(([a-zA-Z]+), '\\1', input_) Does it remove parentheses from words? e.g. (foo) - foo ??? I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words, re.sub((\w+), '\\1', input_) blows up. Why? cs ( has a

Re: re.sub question (regular expressions)

2009-10-16 Thread MRAB
Chris Seberino wrote: What does this line do?... input_ = re.sub(([a-zA-Z]+), '\\1', input_) Why don't you try it? Does it remove parentheses from words? e.g. (foo) - foo ??? No, it puts quotes around them. I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words,

[issue6438] cygwinccompiler regular expressions broken

2009-07-12 Thread Tarek Ziadé
Changes by Tarek Ziadé ziade.ta...@gmail.com: -- resolution: - accepted title: cygwincompiler regular expressions broken - cygwinccompiler regular expressions broken ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6438

[issue6438] cygwinccompiler regular expressions broken

2009-07-12 Thread Tarek Ziadé
Tarek Ziadé ziade.ta...@gmail.com added the comment: done in r73975, r73976 -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6438 ___

[issue6438] cygwincompiler regular expressions broken

2009-07-08 Thread Tarek Ziadé
New submission from Tarek Ziadé ziade.ta...@gmail.com: The regular expressions used in distutils to build a extension using the mingw32 compiler are messed up because they try to work with bytes (since Popen behavior changed) using string patterns. I have to cleanup these regular expressions

[issue4882] Behavior of backreferences to named groups in regular expressions unclear

2009-03-31 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Committed a similar patch in r70866. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4882 ___

re-try 0.7: Try Python regular expressions online

2009-03-28 Thread Christof Hoeke
== re-try == :version: 0.7 URL --- http://re-try.appspot.com/ what is it -- A small online browser application to try out Python regular expressions. It is based on http://cthedot.de/retest/ which has been around for some years but I never had a Python hosting service

[issue694374] Recursive regular expressions

2009-03-24 Thread Peter Waller
Peter Waller peter.wal...@gmail.com added the comment: It looks like Matthew has dropped this feature from consideration. See msg83993 . -- nosy: +pwaller ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue694374

[issue694374] Recursive regular expressions

2009-03-24 Thread Matthew Barnett
whether any particular change will be accepted. 2. I think that recursive regular expressions are starting to stray into the realm of pyparsing and so forth. So I might not have the time (and I don't think I have the inclination!) to implement them

regular expressions, stack and nesting

2009-03-22 Thread Aaron Brady
Hi, Every so often the group gets a request for parsing an expression. I think it would be significantly easier to do if regular expressions could modify a stack. However, since you might nearly as well write Python, maybe there is a compromise. Could the Secret Labs' regular expression engine

Re: regular expressions, stack and nesting

2009-03-22 Thread Chris Rebert
2009/3/22 Aaron Brady castiro...@gmail.com: Hi, Every so often the group gets a request for parsing an expression.  I think it would be significantly easier to do if regular expressions could modify a stack.  However, since you might nearly as well write Python, maybe there is a compromise

Re: regular expressions, stack and nesting

2009-03-22 Thread Aaron Brady
On Mar 22, 12:18 pm, Chris Rebert c...@rebertia.com wrote: 2009/3/22 Aaron Brady castiro...@gmail.com: Hi, Every so often the group gets a request for parsing an expression.  I think it would be significantly easier to do if regular expressions could modify a stack.  However, since you

[issue4882] Behavior of backreferences to named groups in regular expressions unclear

2009-02-10 Thread alec resnick
alec resnick aresnick...@gmail.com added the comment: Hi Georg! Sorry to be so long in getting back to you. I've attached a suggested patch for the python-2.6.1-docs-text/library/re.txt documentation. Also, in looking over Kuchling's HOWTO, the necessary information is actually there, and I

Trouble with regular expressions

2009-02-07 Thread LaundroMat
Hi, I'm quite new to regular expressions, and I wonder if anyone here could help me out. I'm looking to split strings that ideally look like this: Update: New item (Household) into a group. This expression works ok: '^(Update:)?(.*)(\(.*\))$' - it returns (Update, New item, (Household)) Some

Re: Trouble with regular expressions

2009-02-07 Thread John Machin
On Feb 7, 11:18 pm, LaundroMat laun...@gmail.com wrote: Hi, I'm quite new to regular expressions, and I wonder if anyone here could help me out. I'm looking to split strings that ideally look like this: Update: New item (Household) into a group. This expression works ok: '^(Update

Re: Trouble with regular expressions

2009-02-07 Thread MRAB
LaundroMat wrote: Hi, I'm quite new to regular expressions, and I wonder if anyone here could help me out. I'm looking to split strings that ideally look like this: Update: New item (Household) into a group. This expression works ok: '^(Update:)?(.*)(\(.*\))$' - it returns (Update, New item

Re: Trouble with regular expressions

2009-02-07 Thread John Machin
On Feb 8, 1:37 am, MRAB goo...@mrabarnett.plus.com wrote: LaundroMat wrote: Hi, I'm quite new to regular expressions, and I wonder if anyone here could help me out. I'm looking to split strings that ideally look like this: Update: New item (Household) into a group. This expression

Re: Trouble with regular expressions

2009-02-07 Thread MRAB
John Machin wrote: On Feb 8, 1:37 am, MRAB goo...@mrabarnett.plus.com wrote: LaundroMat wrote: Hi, I'm quite new to regular expressions, and I wonder if anyone here could help me out. I'm looking to split strings that ideally look like this: Update: New item (Household) into a group

Re: Trouble with regular expressions

2009-02-07 Thread John Machin
On Feb 8, 10:15 am, MRAB goo...@mrabarnett.plus.com wrote: John Machin wrote: On Feb 8, 1:37 am, MRAB goo...@mrabarnett.plus.com wrote: LaundroMat wrote: Hi, I'm quite new to regular expressions, and I wonder if anyone here could help me out. I'm looking to split strings that ideally

Re: Trouble with regular expressions

2009-02-07 Thread MRAB
John Machin wrote: On Feb 8, 10:15 am, MRAB goo...@mrabarnett.plus.com wrote: John Machin wrote: On Feb 8, 1:37 am, MRAB goo...@mrabarnett.plus.com wrote: LaundroMat wrote: Hi, I'm quite new to regular expressions, and I wonder if anyone here could help me out. I'm looking to split strings

Re: Regular Expressions...

2009-01-20 Thread Aahz
confronted with a problem, think I know, I'll use regular expressions. Now they have two problems.' --Jamie Zawinski, comp.emacs.xemacs, 8/1997 Although there are times when regexes are your best option, Python has many other good options for processing strings, and your code readability will usually

[issue4882] Behavior of backreferences to named groups in regular expressions unclear

2009-01-18 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: I'm happy to review such a patch. -- priority: - low ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4882 ___

Relative performance of comparable regular expressions

2009-01-13 Thread Barak, Ron
Hi, I have a question about relative performance of comparable regular expressions. I have large log files that start with three letters month names (non-unicode). Which would give better performance, matching with ^[a-zA-Z]{3}, or with ^\S{3} ? Also, which is better (if different at all): \d

Re: Relative performance of comparable regular expressions

2009-01-13 Thread John Machin
On Jan 13, 7:24 pm, Barak, Ron ron.ba...@lsi.com wrote: Hi, I have a question about relative performance of comparable regular expressions. I have large log files that start with three letters month names (non-unicode). Which would give better performance, matching with  ^[a-zA-Z]{3

Re: Relative performance of comparable regular expressions

2009-01-13 Thread Steve Holden
John Machin wrote: On Jan 13, 7:24 pm, Barak, Ron ron.ba...@lsi.com wrote: Hi, I have a question about relative performance of comparable regular expressions. I have large log files that start with three letters month names (non-unicode). Which would give better performance, matching

RE: Relative performance of comparable regular expressions

2009-01-13 Thread Barak, Ron
performance of comparable regular expressions On Jan 13, 7:24 pm, Barak, Ron ron.ba...@lsi.com wrote: Hi, I have a question about relative performance of comparable regular expressions. I have large log files that start with three letters month names (non-unicode). Which would give better

Re: Relative performance of comparable regular expressions

2009-01-13 Thread Chris Rebert
: John Machin [ ] Sent: Tuesday, January 13, 2009 11:15 To: python-list@python.org Subject: Re: Relative performance of comparable regular expressions On Jan 13, 7:24 pm, Barak, Ron ron.ba...@lsi.com wrote: Hi, I have a question about relative performance of comparable regular expressions. I

[issue4882] Behavior of backreferences to named groups in regular expressions unclear

2009-01-09 Thread Jim Jewett
Jim Jewett jimjjew...@users.sourceforge.net added the comment: That sounds like a good idea, particularly since it is a bit different from Perl. Please do write up the a clarification. Typically, I have either attached a file with the suggested wording, or included it in a comment from which

[issue4882] Behavior of backreferences to named groups in regular expressions unclear

2009-01-08 Thread alec resnick
New submission from alec resnick aresnick...@gmail.com: I recently learned about named groups in Python regular expressions. Almost all the documentation I've found online explains what they are and give a simple example of how to use them. I was trying to use the variables outside

Regular Expressions...

2009-01-07 Thread Ken D'Ambrosio
Hi, all. As a recovering Perl guy, I have to admit I don't quite get the re module. For example, I'd like to do a few things (I'm going to use phone numbers, 'cause that's what I'm currently dealing with): 12345678900 -- How would I: - Get just the area code? - Get just the seven-digit number?

Re: Regular Expressions...

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 8:54 AM, Ken D'Ambrosio ken.dambro...@segway.com wrote: Hi, all. As a recovering Perl guy, I have to admit I don't quite get the re module. For example, I'd like to do a few things (I'm going to use phone numbers, 'cause that's what I'm currently dealing with):

Re: Regular Expressions...

2009-01-07 Thread MRAB
Ken D'Ambrosio wrote: Hi, all. As a recovering Perl guy, I have to admit I don't quite get the re module. For example, I'd like to do a few things (I'm going to use phone numbers, 'cause that's what I'm currently dealing with): 12345678900 -- How would I: - Get just the area code? - Get

Re: Regular Expressions...

2009-01-07 Thread James Stroud
Ken D'Ambrosio wrote: Hi, all. As a recovering Perl guy, [snip] In Perl, I'd so something like m/^1(...)(...)/; Indeed it seems you are recovering from an especially bad case. I recommend two doses of the python cookbook per day for one to two months. Report back here after your first

Re: Regular Expressions...

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 10:03 AM, James Stroud jstr...@mbi.ucla.edu wrote: (...) Indeed it seems you are recovering from an especially bad case. I recommend two doses of the python cookbook per day for one to two months. Report back here after your first cycle and we'll tell you how you are

Re: Regular Expressions...

2009-01-07 Thread bearophileHUGS
Ken D'Ambrosio:  But the Python stuff simply isn't clicking for me. For people coming from Perl that want to perform some string processing with Python I suggest to learn first array/string slices and string methods. And to try to use the regular expressions as little as possible. Bye

Regular Expressions...

2009-01-07 Thread Ken D'Ambrosio
Hi, all. As a recovering Perl guy, I have to admit I don't quite get the re module. For example, I'd like to do a few things (I'm going to use phone numbers, 'cause that's what I'm currently dealing with): 12345678900 -- How would I: - Get just the area code? - Get just the seven-digit number?

Re: Regular Expressions...

2009-01-07 Thread Ben Finney
) = phone_number_match.groups() area_code '234' local_number '5678900' Python regular expressions also allow naming each group, for later access to the matches via a dict: phone_number_regex = '^1(?Parea_code\d{3})(?Plocal_number\d{7})' phone_number_pattern = re.compile

Re: Regular Expressions...

2009-01-07 Thread Cameron Simpson
On 07Jan2009 19:51, Ken D'Ambrosio k...@jots.org wrote: | Hi, all. As a recovering Perl guy, I have to admit I don't quite get | the re module. For example, I'd like to do a few things (I'm going to use | phone numbers, 'cause that's what I'm currently dealing with): | 12345678900 -- How would

Searching for Regular Expressions in a string WITH overlap

2008-11-20 Thread Ben
I apologize in advance for the newbie question. I'm trying to figure out a way to find all of the occurrences of a regular expression in a string including the overlapping ones. For example, given the string 123456789 I'd like to use the RE ((2)|(4))[0-9]{3} to get the following matches: 2345

Re: Searching for Regular Expressions in a string WITH overlap

2008-11-20 Thread Matimus
On Nov 20, 4:31 pm, Ben [EMAIL PROTECTED] wrote: I apologize in advance for the newbie question.  I'm trying to figure out a way to find all of the occurrences of a regular expression in a string including the overlapping ones. For example, given the string 123456789 I'd like to use the RE

Re: regular expressions ... slow

2008-11-19 Thread Kay Schluehr
On 18 Nov., 18:47, Stefan Behnel [EMAIL PROTECTED] wrote: Kay Schluehr wrote: All of this is prototyped in Python and it is still work in progress. As long as development has not reached a stable state I refuse to rebuild the system in an optimized C version. And rightfully so: 1) the

Re: regular expressions ... slow

2008-11-19 Thread Lawrence D'Oliveiro
Uwe Schmitt wrote: Are there any plans to speed up Pythons regular expression module ? Or is the example in this artricle too far from reality ??? http://regex.info/blog/2006-09-15/247 -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expressions ... slow

2008-11-18 Thread Kay Schluehr
On 17 Nov., 22:37, Uwe Schmitt [EMAIL PROTECTED] wrote: Hi, Is anobody aware of this post: http://swtch.com/~rsc/regexp/regexp1.html ? Are there any plans to speed up Pythons regular expression module ? Or is the example in this artricle too far from reality ??? Greetings, Uwe Some

Re: regular expressions ... slow

2008-11-18 Thread Stefan Behnel
Kay Schluehr wrote: All of this is prototyped in Python and it is still work in progress. As long as development has not reached a stable state I refuse to rebuild the system in an optimized C version. And rightfully so: 1) the approach is algorithmically better, so it may even beat the

regular expressions ... slow

2008-11-17 Thread Uwe Schmitt
Hi, Is anobody aware of this post: http://swtch.com/~rsc/regexp/regexp1.html ? Are there any plans to speed up Pythons regular expression module ? Or is the example in this artricle too far from reality ??? Greetings, Uwe -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expressions ... slow

2008-11-17 Thread Jerry Hill
On Mon, Nov 17, 2008 at 4:37 PM, Uwe Schmitt [EMAIL PROTECTED] wrote: Hi, Is anobody aware of this post: http://swtch.com/~rsc/regexp/regexp1.html ? Yes, it's been brought up here, on python-dev and python-ideas several times in the past year and a half. Are there any plans to speed up

Re: regular expressions ... slow

2008-11-17 Thread Terry Reedy
Uwe Schmitt wrote: Hi, Is anobody aware of this post: http://swtch.com/~rsc/regexp/regexp1.html ? Near the end: While writing the text editor sam [6] in the early 1980s, Rob Pike wrote a new regular expression implementation, which Dave Presotto extracted into a library that appeared in

Re: regular expressions ... slow

2008-11-17 Thread Terry Reedy
Jerry Hill wrote: On Mon, Nov 17, 2008 at 4:37 PM, Uwe Schmitt [EMAIL PROTECTED] wrote: Hi, Is anobody aware of this post: http://swtch.com/~rsc/regexp/regexp1.html ? Yes, it's been brought up here, on python-dev and python-ideas several times in the past year and a half. Are there any

Re: regular expressions ... slow

2008-11-17 Thread MRAB
On Nov 17, 10:24 pm, Terry Reedy [EMAIL PROTECTED] wrote: Jerry Hill wrote: On Mon, Nov 17, 2008 at 4:37 PM, Uwe Schmitt [EMAIL PROTECTED] wrote: Hi, Is anobody aware of this post:  http://swtch.com/~rsc/regexp/regexp1.html? Yes, it's been brought up here, on python-dev and

Re: regular expressions ... slow

2008-11-17 Thread Gabriel Genellina
a pathological case. There are some known cases of horrible behaviour that are explained in many books on regular expressions. If you avoid those constructs when writing the RE, you're reasonably safe. I for myself avoid using RE at all :) -- Gabriel Genellina -- http://mail.python.org/mailman

Re: Perl/Python regular expressions vs. Boost.regex?

2008-10-25 Thread skip
Rob Quoting from : url:http://www.boost.org/doc/libs/1_36_0/libs/regex/doc/html/boost_regex/ref/regex_match.html Rob quote Rob Important Rob Note that the result is true only if the expression matches the Rob whole of the input sequence. If you want to search for an

Perl/Python regular expressions vs. Boost.regex?

2008-10-23 Thread skip
A colleague wrote a C++ library here at work which uses the Boost.regex library. I quickly discovered an apparent problem with how it searches. Unlike re.match the regex_match function in that library effectively anchors the match at both the start and the end. Can other people confirm this?

Re: Perl/Python regular expressions vs. Boost.regex?

2008-10-23 Thread tomohiro kusumi
I was confused when I first used Boost regualr expressions, but I got used to it now. Aside from it, I think Boost regular expression makes you write too much code just to do a simple pattern matching. Tomohiro Kusumi 2008/10/23 [EMAIL PROTECTED] A colleague wrote a C++ library here at work

Re: Perl/Python regular expressions vs. Boost.regex?

2008-10-23 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: A colleague wrote a C++ library here at work which uses the Boost.regex library. I quickly discovered an apparent problem with how it searches. Unlike re.match the regex_match function in that library effectively anchors the match at

[issue694374] Recursive regular expressions

2008-10-13 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: Perl (?number) for calling numbered groups and (?name) for named groups (Perl also supports (?Pname)). (?R) is equivalent to (?0). It's interesting that the documentation for both Perl and PCRE say that they support (?Pname) because that's

Regular expressions and Unicode

2008-10-02 Thread Jeffrey Barish
I have a regular expression that I use to extract the surname: surname = r'(?u).+ (\w+)' However, when I apply it to this Unicode string, I get only the first 3 letters of the surname: name = 'Anton\xc3\xadn Dvo\xc5\x99\xc3\xa1k' surname_re = re.compile(surname) m = surname_re.search(name)

Re: Regular expressions and Unicode

2008-10-02 Thread skip
Jeffrey However, when I apply it to this Unicode string, I get only the Jeffrey first 3 letters of the surname: Jeffrey name = 'Anton\xc3\xadn Dvo\xc5\x99\xc3\xa1k' Maybe name = unicode('Anton\xc3\xadn Dvo\xc5\x99\xc3\xa1k', utf-8) ? Yup, that works: name =

Re: Regular expressions and Unicode

2008-10-02 Thread Peter Otten
Jeffrey Barish wrote: I have a regular expression that I use to extract the surname: surname = r'(?u).+ (\w+)' However, when I apply it to this Unicode string, I get only the first 3 letters of the surname: name = 'Anton\xc3\xadn Dvo\xc5\x99\xc3\xa1k' That's a byte string. You can

Regular expressions question

2008-10-02 Thread aditya shukla
Hello folks , I trying to match a pattern in a string , i am new in using re .This is what is happening When i do this p = re.compile('(\[NHX:)') m = p.match([NHX:C=0.195.0]) print m _sre.SRE_Match object at 0x013FE1E0 --- thus i am able to find the match but when i use the string m =

Re: Regular expressions question

2008-10-02 Thread Vlastimil Brom
2008/10/2 aditya shukla [EMAIL PROTECTED] Hello folks , I trying to match a pattern in a string , i am new in using re .This is what is happening When i do this p = re.compile('(\[NHX:)') m = p.match([NHX:C=0.195.0]) print m _sre.SRE_Match object at 0x013FE1E0 --- thus i am able to

[issue694374] Recursive regular expressions

2008-09-30 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: I'll have a look at this. No promises, though. -- nosy: +mrabarnett ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue694374 ___

Negative regular expressions (searching for i not inside command)

2008-08-28 Thread Bart Kastermans
I have a file in which I am searching for the letter i (actually a bit more general than that, arbitrary regular expressions could occur) as long as it does not occur inside an expression that matches \\.+?\b (something started by a backslash and including the word that follows). More concrete

Re: Negative regular expressions (searching for i not inside command)

2008-08-28 Thread Guilherme Polo
On Thu, Aug 28, 2008 at 5:04 PM, Bart Kastermans [EMAIL PROTECTED] wrote: I have a file in which I am searching for the letter i (actually a bit more general than that, arbitrary regular expressions could occur) as long as it does not occur inside an expression that matches \\.+?\b (something

Re: Negative regular expressions (searching for i not inside command)

2008-08-28 Thread castironpi
On Aug 28, 4:04 pm, Guilherme Polo [EMAIL PROTECTED] wrote: On Thu, Aug 28, 2008 at 5:04 PM, Bart Kastermans [EMAIL PROTECTED] wrote: I have a file in which I am searching for the letter i (actually a bit more general than that, arbitrary regular expressions could occur) as long

Re: Negative regular expressions (searching for i not inside command)

2008-08-28 Thread Terry Reedy
Bart Kastermans wrote: I have a file in which I am searching for the letter i (actually a bit more general than that, arbitrary regular expressions could occur) as long as it does not occur inside an expression that matches \\.+?\b (something started by a backslash and including the word

regular expressions.

2008-08-08 Thread Atul.
Hey All, I have been playing around with REs and could not get the following code to run. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) anything wrong I have done? Regards, Atul. -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expressions.

2008-08-08 Thread Peter Otten
Atul. wrote: I have been playing around with REs and could not get the following code to run. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) anything wrong I have done? Yes. You didn't paste the traceback into your message. import re vowel = r'[aeiou]' re.findall(vowel,

Re: regular expressions.

2008-08-08 Thread Atul.
Yes. You didn't paste the traceback into your message. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) ['o', 'e'] It works as expected here. Peter When I key this input in IDLE it works but when I try to run the module it wont work. --

Re: regular expressions.

2008-08-08 Thread Alexei Zankevich
Use the print statement: import re vowel = r'[aeiou]' print re.findall(vowel, rvowel) Alexey On Fri, Aug 8, 2008 at 2:17 PM, Atul. [EMAIL PROTECTED] wrote: Yes. You didn't paste the traceback into your message. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) ['o', 'e']

Re: regular expressions.

2008-08-08 Thread Peter Otten
Atul. wrote: Yes. You didn't paste the traceback into your message. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) ['o', 'e'] It works as expected here. Peter When I key this input in IDLE it works but when I try to run the module it wont work. What's the name of your

Re: regular expressions.

2008-08-08 Thread Atul.
On Aug 8, 4:22 pm, Peter Otten [EMAIL PROTECTED] wrote: Atul. wrote: Yes. You didn't paste the traceback into your message. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) ['o', 'e'] It works as expected here. Peter When I key this input in IDLE it works but when I

Re: regular expressions.

2008-08-08 Thread Atul.
On Aug 8, 4:33 pm, Atul. [EMAIL PROTECTED] wrote: On Aug 8, 4:22 pm, Peter Otten [EMAIL PROTECTED] wrote: Atul. wrote: Yes. You didn't paste the traceback into your message. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) ['o', 'e'] It works as expected here.

Re: regular expressions.

2008-08-08 Thread Diez B. Roggisch
Atul. schrieb: On Aug 8, 4:33 pm, Atul. [EMAIL PROTECTED] wrote: On Aug 8, 4:22 pm, Peter Otten [EMAIL PROTECTED] wrote: Atul. wrote: Yes. You didn't paste the traceback into your message. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) ['o', 'e'] It works as expected here. Peter

Re: regular expressions.

2008-08-08 Thread Peter Otten
Atul. wrote: On Aug 8, 4:33 pm, Atul. [EMAIL PROTECTED] wrote: On Aug 8, 4:22 pm, Peter Otten [EMAIL PROTECTED] wrote: Atul. wrote: Yes. You didn't paste the traceback into your message. import re vowel = r'[aeiou]' re.findall(vowel, rvowel) ['o', 'e'] It works as

Re: regular expressions.

2008-08-08 Thread Atul.
The same file when I use with the following does not work. import re vowel = r'[u\u093eu\u093fu\u0940u\u0941u\u0942u\u0943u\u0944u\u0945u\u0946u\u0947u\u0948u\u0949u\u094au\u094bu\u094c]' print re.findall(vowel, u\u092f\u093e\u0902\u091a\u094d\u092f\u093e, re.UNICODE) [EMAIL

Re: regular expressions.

2008-08-08 Thread Peter Otten
Atul. wrote: The same file when I use with the following does not work. import re vowel = r'[u\u093eu\u093fu\u0940u\u0941u\u0942u\u0943u\u0944u\u0945u\u0946u\u0947u\u0948u\u0949u\u094au\u094bu\u094c]' print re.findall(vowel, u\u092f\u093e\u0902\u091a\u094d\u092f\u093e, re.UNICODE)

Re: regular expressions.

2008-08-08 Thread Hrvoje Niksic
Atul. [EMAIL PROTECTED] writes: the following does not work. import re vowel = r'[u\u093eu\u093fu\u0940u\u0941u\u0942u\u0943u\u0944u\u0945u\u0946u\u0947u\u0948u\u0949u\u094au\u094bu\u094c]' Unfortunately you cannot embed arbitrary Python string constants (u...) in regular expressions. What

Re: find and replace with regular expressions

2008-08-01 Thread dusans
On Jul 31, 10:07 pm, [EMAIL PROTECTED] wrote: I am using regular expressions to search a string (always full sentences, maybe more than one sentence) for common abbreviations and remove the periods.  I need to break the string into different sentences but split('.') doesn't solve the whole

Re: find and replace with regular expressions

2008-08-01 Thread dusans
On Aug 1, 12:53 pm, dusans [EMAIL PROTECTED] wrote: On Jul 31, 10:07 pm, [EMAIL PROTECTED] wrote: I am using regular expressions to search a string (always full sentences, maybe more than one sentence) for common abbreviations and remove the periods.  I need to break the string

find and replace with regular expressions

2008-07-31 Thread chrispoliquin
I am using regular expressions to search a string (always full sentences, maybe more than one sentence) for common abbreviations and remove the periods. I need to break the string into different sentences but split('.') doesn't solve the whole problem because of possible periods in the middle

Re: find and replace with regular expressions

2008-07-31 Thread Mensanator
On Jul 31, 3:07 pm, [EMAIL PROTECTED] wrote: I am using regular expressions to search a string (always full sentences, maybe more than one sentence) for common abbreviations and remove the periods.  I need to break the string into different sentences but split('.') doesn't solve the whole

Re: find and replace with regular expressions

2008-07-31 Thread Mensanator
On Jul 31, 3:56 pm, Mensanator [EMAIL PROTECTED] wrote: On Jul 31, 3:07 pm, [EMAIL PROTECTED] wrote: I am using regular expressions to search a string (always full sentences, maybe more than one sentence) for common abbreviations and remove the periods.  I need to break the string

Re: find and replace with regular expressions

2008-07-31 Thread Paul McGuire
On Jul 31, 3:07 pm, [EMAIL PROTECTED] wrote: middle_abbr = re.compile('[A-Za-z0-9]\.[A-Za-z0-9]\.') When defining re's with string literals, it is good practice to use the raw string literal format (precede with an 'r'): middle_abbr = re.compile(r'[A-Za-z0-9]\.[A-Za-z0-9]\.') What

Re: find and replace with regular expressions

2008-07-31 Thread MRAB
On Jul 31, 9:07 pm, [EMAIL PROTECTED] wrote: I am using regular expressions to search a string (always full sentences, maybe more than one sentence) for common abbreviations and remove the periods.  I need to break the string into different sentences but split('.') doesn't solve the whole

Using Groups inside Braces with Regular Expressions

2008-07-13 Thread Chris
I'm trying to delimit sentences in a block of text by defining the end-of-sentence marker as a period followed by a space followed by an uppercase letter or end-of-string. I'd imagine the regex for that would look something like: [^(?:[A-Z]|$)]\.\s+(?=[A-Z]|$) However, Python keeps giving me an

Re: Using Groups inside Braces with Regular Expressions

2008-07-13 Thread MRAB
On Jul 14, 12:05 am, Chris [EMAIL PROTECTED] wrote: I'm trying to delimit  sentences in a block of text by defining the end-of-sentence marker as a period followed by a space followed by an uppercase letter or end-of-string. I'd imagine the regex for that would look something like:

Re: Using Groups inside Braces with Regular Expressions

2008-07-13 Thread Chris
On Jul 13, 8:14 pm, MRAB [EMAIL PROTECTED] wrote: On Jul 14, 12:05 am, Chris [EMAIL PROTECTED] wrote: I'm trying to delimit sentences in a block of text by defining the end-of-sentence marker as a period followed by a space followed by an uppercase letter or end-of-string. I'd imagine

Re: Using Groups inside Braces with Regular Expressions

2008-07-13 Thread John Machin
On Jul 14, 9:05 am, Chris [EMAIL PROTECTED] wrote: Misleading subject. [] brackets or square brackets {} braces or curly brackets () parentheses or round brackets I'm trying to delimit sentences in a block of text by defining the end-of-sentence marker as a period followed by a space

Re: re.search much slower then grep on some regular expressions

2008-07-10 Thread Kris Kennaway
John Machin wrote: Uh-huh ... try this, then: http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/ You could use this to find the Str cases and the prefixes of the re cases (which seem to be no more complicated than 'foo.*bar.*zot') and use something slower like Python's re to search the

Re: re.search much slower then grep on some regular expressions

2008-07-10 Thread J. Cliff Dyer
expressions into a single DFA. Once that's done, the input can be processed in a time proportional to the number of characters to be scanned, and independent of the number or complexity of the regular expressions. Python's existing regular expression matchers do not have this property

Re: re.search much slower then grep on some regular expressions

2008-07-10 Thread Sebastian lunar Wiesner
Marc 'BlackJack' Rintsch [EMAIL PROTECTED]: On Mon, 07 Jul 2008 16:44:22 +0200, Sebastian \lunar\ Wiesner wrote: Mark Wooding [EMAIL PROTECTED]: Sebastian lunar Wiesner [EMAIL PROTECTED] wrote: # perl -e '(a x 10) =~ /^(ab?)*$/;' zsh: segmentation fault perl -e '(a x 10) =~

<    1   2   3   4   5   6   7   8   9   10   >