[wingide-users] regex search, dot is always DOTALL?

Wingware Support support at wingware.com
Thu Nov 8 09:00:32 MST 2007


Sebastian Fey wrote:
> id like to convert
> 
> "print whatever"
> to
> "print(whatever)"
> 
> i tried this pattern:
> 
> search: print(.*)
> replace: print(\1)
> 
> but i get:
> 
> "print(whatever
> )"
> 
> though DOTALL is not marked.
> python.re does not behave like this.
> what am i doing wrong?

It looks like it does this when the line endings in the file are CRLF.  It
seems to work with LF line endings.  I see there is also a different problem
with CR-only line endings -- it ends up matching the whole file when it
should not.  We'll try to fix these bugs soon.

As a work-around, you can convert to LF line endings by right clicking on
the file and changing Line Ending Style, then convert back after the replace.

If you're converting to Python 3.0, it may be worth looking at the converter
script in the Subversion sandbox:

http://svn.python.org/view/sandbox/trunk/2to3/

Someone pointed out to me that it converts only a supported subset of Python 2.6+
("transitional Python") which seems odd to me -- somehow there's got to be a way
to automatically convert 99% of your code and clearly flag the rest.  Anyway,
I haven't had time to play with it myself but that's how I plan to try to
convert our debugger code so we can eventually add support for Python 3.0.

Anyway, most people seem to think it's premature to convert anything significant
to Python 3.0 since things may still change.  Someone said 3.0b1 would be
a good time to look at this more seriously (hence my own procrastination ;-).

Thanks for the bug report.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list