extract text from a string

Jon Clements joncle at googlemail.com
Thu Nov 9 10:50:53 EST 2006


boris.smir... at gmail.com wrote:

> Hallo all,
>
> I have tried for a couple of hours to solve my problem with re but I
> have no success.
>
> I have a string containing: "+abc_cde.fgh_jkl\n" and what I need to
> become is "abc_cde.fgh_jkl".  Could anybody be so kind and write me a
> code of how to extract this text from that string?

Perhaps if you described what the actual *criteria* is for the
translation; for instance, "I need to keep only letters, numbers and
punctuation characters" etc... Going by your example, it's tempting to
suggest the best method would be string_name[1:-1] and that you don't
need a regex.

Jon.




More information about the Python-list mailing list