regular expressions
J. Clifford Dyer
jcd at sdf.lonestar.org
Tue Nov 6 12:07:04 EST 2007
On Tue, Nov 06, 2007 at 08:49:33AM -0800, krishnamanenianil at gmail.com wrote regarding regular expressions:
>
> hi i am looking for pattern in regular expreesion that replaces
> anything starting with and betweeen http:// until /
> like http://www.start.com/startservice/yellow/ fdhttp://helo/abcd will
> be replaced as
> p/startservice/yellow/ fdp/abcd
>
You don't need regular expressions to do that. Look into the methods that strings have. Look at slicing. Look at len. Keep your code readable for future generations.
Py>>> help(str)
Py>>> dir(str)
Py>>> help(str.startswith)
Cheers,
Cliff
More information about the Python-list
mailing list