question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Find and replace: Greedy regular expressions

See original GitHub issue

Spyder version: 2.3.9 OS: Ubuntu 14 Python 2.7

Find and replace doesn’t work for non greedy regular expressions. This regular expression:

        \{\$documento\['(.+?)'\]\}

doesnt recognize this text:

{$documento['DOC_CODIGO']}','{$documento['DOC_DOCID_EDP']}','{$documento['DOC_ESTADO']}','{$documento['DOC_BORRADO']}','{$documento['DOC_SAP_CODMATERIAL']}'

But this other regular expressiones does (without the question mark):

        \{\$documento\['(\w+)'\]\}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, Nov 16, 2016

@rlaverde, please create a PR based on @aplicacionamedida work.

0reactions
ccordoba12commented, Nov 22, 2016

No prob, thanks to you for reporting it 😃

But please be aware that this only works if you’re using Spyder with PyQt5 (not PyQt4).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Greedy and lazy quantifiers - The Modern JavaScript Tutorial
The first thing to do is to locate quoted strings, and then we can replace them. A regular expression like /".+"/g (a quote,...
Read more >
Find and replace text using regular expressions - JetBrains
Press Ctrl+R to open the search and replace pane. · Enter a search string in the top field and a replace string in...
Read more >
RegEx - find and replace getting too greedy - Stack Overflow
I'm trying to use a RegEx program to edit XML, replacing certain images with their own alt text. Here's what I got. <graphic.*-A.[a-zA- ......
Read more >
Python Regex Greedy vs Non-Greedy Quantifiers - Finxter
A greedy match means that the regex engine (the one which tries to find your pattern in the string) matches as many characters...
Read more >
Greedy match in MS Word regular expression? - Super User
I try to do that with Word's built-in find and replace using regex. As the desired end of my regular expression is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found