Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Use QRegularExpression for find and replace (only for PyQt5) #3696

Merged
merged 2 commits into from
Nov 22, 2016

Conversation

rlaverde
Copy link
Member

Partially fixes #3408 (only PyQt5)

QRegExp didn't support lazy quantifiers, like *?, +?, etc. It's better to use QRegularExpression.

Although QRegularExpression is only avalaible since Qt5, so It'll continue using QRegExp for PyQT4

@rlaverde rlaverde changed the title Use QRegularExpression for find and replace (in Pyqt5). PR: Use QRegularExpression for find and replace (in Pyqt5). Nov 17, 2016
@rlaverde rlaverde force-pushed the fix-lazy-regex branch 2 times, most recently from 987074c to 67c3ee3 Compare November 17, 2016 01:57
- This change allows the use of lazy regular expresions
- Change % formating for format() in find_text function
@ccordoba12 ccordoba12 added this to the v3.1 milestone Nov 17, 2016
@ccordoba12
Copy link
Member

Nice, thanks for the quick fix @rlaverde!

Could you add a test for this?


if PYQT5:
from qtpy.QtCore import QRegularExpression
elif PYQT4:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use else here

if case:
pattern.setPatternOptions(
QRegularExpression.CaseInsensitiveOption)
elif PYQT4:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also use else here :-)

@ccordoba12
Copy link
Member

ccordoba12 commented Nov 17, 2016

Supporting this for PyQt5 if fine because we will have to eventually deprecate PyQt4 because it's not maintained anymore.

@ccordoba12
Copy link
Member

@rlaverde, are you working on test for this one?

@ccordoba12
Copy link
Member

LGTM, merging. Thanks @rlaverde :-)

@ccordoba12 ccordoba12 changed the title PR: Use QRegularExpression for find and replace (in Pyqt5). PR: Use QRegularExpression for find and replace (only for PyQt5) Nov 22, 2016
@ccordoba12 ccordoba12 merged commit 9d478f9 into spyder-ide:3.x Nov 22, 2016
ccordoba12 added a commit that referenced this pull request Nov 22, 2016
@rlaverde rlaverde deleted the fix-lazy-regex branch December 26, 2016 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants