User forums > General (but related to Code::Blocks)
Question about regex flavor
MortenMacFly:
--- Quote from: bigbug on December 07, 2006, 02:55:55 pm ---but it works like a charm, if I use the method "Compile" with "wxRE_ADVANCED".
--- End quote ---
Well, again: All you need is a choicebox in the regex testbed plugin GUI and a simple switch case operation accordingly in the code. What's the problem?! ;-)
With regards, Morten.
bigbug:
But it could also be used in the search/replace dialog without any problems, couldn't it?
I think, moving from POSIX EREs to AREs isn't very hard at all:
--- Quote from: the wx manual ---The only feature of AREs that is actually incompatible with POSIX EREs is that \ does not lose its special significance inside bracket expressions.
--- End quote ---
dmoore:
--- Quote from: bigbug on December 07, 2006, 04:53:14 pm ---But it could also be used in the search/replace dialog without any problems, couldn't it?
I think, moving from POSIX EREs to AREs isn't very hard at all:
--- Quote from: the wx manual ---The only feature of AREs that is actually incompatible with POSIX EREs is that \ does not lose its special significance inside bracket expressions.
--- End quote ---
--- End quote ---
the only problem is CB doesn't currently use the wxWidget's regex engine for Find and Replace, it uses Scintilla's internal regex engine. I've played around with adding support for wxregex in CBs search/replace, i will submit a patch soon if all goes well or others don't beat me to it. My main concern is whether the text locations reported by Scintilla's "find" method will match the text locations reported by wxRegex's "matches" method.
bigbug:
--- Quote from: dmoore ---I've played around with adding support for wxregex in CBs search/replace, i will submit a patch soon if all goes well or others don't beat me to it.
--- End quote ---
That's nice :), I hope your patch will be accepted.
dmoore:
Patch:
http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1701&group_id=5358
After applying the patch, choose the "Advanced REGEX" checkbox from the Settings -> Editor menu and then check "Regular Expression" in the Find or Replace dialogs. Should work for Local Find/Replace as well as Find/Replace in files.
please test on a dummy project - if CB goes on a code eating rampage with this, don't say I didn't warn you.
NOTE: I'm use wxRE_ADVANCED with wxRE_NEWLINE in the regex compile statement. wxRE_NEWLINE supports ^ and $ for start beginning of lines (rather than start beginning of entire file).
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version