Russell Blau wrote: > "Johny" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> How can I find the first space using regex? >> >> For example I have text >> Text=' This is a sample ' > > Why do you need to use a regex? > > text = text.replace(" ", "")
You are aware that this is producing nonsense given the OP's requirements? >>> print Text.replace(" ", "") Thisisasample Instead, the OP wants >>> print Text.strip() This is a sample Diez -- http://mail.python.org/mailman/listinfo/python-list