|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Jul 05, 2010 5:36 am
[3.22]BUG?: Find/Replace Regex syntax not working |
I could be wrong about this, and I've never seen it come up until I decided to help someone else who would need to use this feature.
Apparently, if you do:
Find: (\w+)
it will not find it (the parentheses break it). This is a bit heartbreaking because it takes out the possibility of doing something like:
Find: #VAR @(\w+)
Replace: #VAR @{\1}
like many external editors can do. Was this intended? Is this a bug? Was it overlooked? Can it be added? Thanks!
Charneus |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Jul 05, 2010 8:51 am |
Hmm, the behavior is confirmed. Zugg will have to determine if it's a bug because this will do what you want.
Find: #VAR @\(\w+\)
Replace: #VAR @{\1} |
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jul 06, 2010 5:13 pm |
Nothing I can do about this one, sorry. That's the find/replace regex code within the Scintilla editor library. It isn't code that I can access (it's in the DLL). But remember that () in a regular expression are normally reserved for saving subpatterns so Tech is correct that if you want to match () characters verbatim then you need to escape them with the \ character just like in any other regular expression.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Jul 06, 2010 5:42 pm |
Zugg I don't think he was trying to match the verbatim character. It's seems that to match the sub-pattern you need to escape the parentheses. This is more or less sorted though.
|
|
_________________ Asati di tempari! |
|
|
|
|
|