From: Chris G. <cg...@gc...> - 2001-07-03 15:17:13
|
Hi, I'm trying to use a regular expression that uses backreferences in python. Can someone tell me where I cam going wrong? [cgokey@cgokey cgokey]$ jython Jython 2.1a1 on java1.3.0 (JIT: jitc) Type "copyright", "credits" or "license" for more information. >>> import re >>> s = " Title: Ice Core Records" >>> s = re.sub("^(\s*)Title","\1Dataset_Title",s); >>> s '\001Dataset_Title: Ice Core Records' >>> print s Dataset_Title: Ice Core Records >>> It looks like it isn't using the back reference? The resulting output should be indented 3 spaces. Thanks, Chris -- __________________________________________________ /\ \ \_| Christopher D. Gokey, SSAI, NASA/GCMD | | 18 Martin Road, Shelburne Falls, MA 01370 | | Phone: Voice (413) 625-8129 / FAX 208-248-9055 | | cg...@gc... / http://gcmd.nasa.gov | | ICQ #52132386, AOL IM: chrisgokey | | _____________________________________________|_ \_/______________________________________________/ |