On Wed, 11 Feb 2009 21:05:53 -, Paul McGuire
wrote:
On Feb 4, 10:51 am, "Emanuele D'Arrigo" wrote:
Hi everybody,
I'm having a ball with the power of regular expression
Don't forget the ball you can have with the power of ordinary Python
strings, string methods, and string interpolati
On Feb 4, 10:51 am, "Emanuele D'Arrigo" wrote:
> Hi everybody,
>
> I'm having a ball with the power of regular expression
Don't forget the ball you can have with the power of ordinary Python
strings, string methods, and string interpolation!
originalString = "spam:%(first)s ham:%(second)s"
print
>
> Book recommendation: _Mastering Regular Expressions_, Jeffrey Friedl
> --
> Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
I wholeheartedly second this! The third edition is out now.
--
http://mail.python.org/mailman/listinfo/python-list
In article <4c7158d2-5663-46b9-b950-be81bd799...@z6g2000pre.googlegroups.com>,
Emanuele D'Arrigo wrote:
>
>I'm having a ball with the power of regular expression but I stumbled
>on something I don't quite understand:
Book recommendation: _Mastering Regular Expressions_, Jeffrey Friedl
--
Aahz (a
> Hi everybody,
>
> I'm having a ball with the power of regular expression but I stumbled
> on something I don't quite understand:
>
> theOriginalString = "spam:(?P.*) ham:(?P.*)"
> aReplacementPattern = "\(\?P.*\)"
> aReplacementString= "foo"
> re.sub(aReplacementPattern , aReplacementString, the
On Feb 4, 5:17 pm, MRAB wrote:
> You could use the lazy form "*?" which tries to match as little as
> possible, eg "\(\?P.*?\)" where the ".*?" matches:
> spam:(?P.*) ham:(?P.*)
> giving "spam:foo ham:(?P.*)".
A-ha! Of course! That makes perfect sense! Thank you! Problem solved!
Ciao!
Manu
--
Emanuele D'Arrigo wrote:
> Hi everybody,
>
> I'm having a ball with the power of regular expression but I stumbled
> on something I don't quite understand:
>
> theOriginalString = "spam:(?P.*) ham:(?P.*)"
> aReplacementPattern = "\(\?P.*\)"
> aReplacementString= "foo"
> re.sub(aReplacementPattern
Hi everybody,
I'm having a ball with the power of regular expression but I stumbled
on something I don't quite understand:
theOriginalString = "spam:(?P.*) ham:(?P.*)"
aReplacementPattern = "\(\?P.*\)"
aReplacementString= "foo"
re.sub(aReplacementPattern , aReplacementString, theOriginalString)