User forums > General (but related to Code::Blocks)
Infinite loop in RegEx search & replace
Poobah:
If doing a replace search, and you're searching for the end of line and replacing it with something else, it just keeps replacing it, creating a new line after it and then replacing that new line, resulting in an infinite loop if choosing to replace all:
(Make sure to save your work before doing this!)
Text to search for: $
Replace with: ;
Regular expression: True
(Click replace)
(Click all)
dje:
Hi !
Did you try with \r?\n instead of $ (don't know how multiline flag is used) ?
I tried to use reg ex with C::B but the implementation (in scintilla I think) is not complete.
I use external tools to make the reg exp operations.
A great Perl fan.
Poobah:
If I search for either "\r", "\n" or "\r?\n" then it acts as though it hasn't found any occurances of them.
dmoore:
--- Quote from: Poobah on April 05, 2007, 08:43:07 am ---If doing a replace search, and you're searching for the end of line and replacing it with something else, it just keeps replacing it, creating a new line after it and then replacing that new line, resulting in an infinite loop if choosing to replace all:
(Make sure to save your work before doing this!)
Text to search for: $
Replace with: ;
Regular expression: True
(Click replace)
(Click all)
--- End quote ---
interesting. this also affects my patched advanced style regex find and replace. I wrote it to allow the user to enable the wxWidgets regex routines instead of the built-in scintilla editor's regex for find and find&replace. I'll take a look at the bug later in the week if noone else beats me to it.
if interested you can see my advanced regex patch here:
https://developer.berlios.de/patch/?func=detailpatch&patch_id=1701&group_id=5358
(I'm surprised none of the developers have looked at it yet...)
and test here using a pre-compiled older revision of CB (windows only):
http://prdownload.berlios.de/cbilplugin/CodeBlocks_unicode_rev3369_with_IL_plugins_Rev1.exe
(you will need to enable advanced style regexes under "Settings" -> "Editor" (under other options)
Poobah:
Does your patch allow usage of subexpressions and all that fancy stuff? I have been wanting to be able to use subexpressions in CB's search and replace.
Navigation
[0] Message Index
[#] Next page
Go to full version