Partial string replacement?

A swapping-ground for Regular Expression syntax

Partial string replacement?

Postby bobkoure » Thu Jun 07, 2007 2:30 pm

It's likely something I've gotten used to in using the Python "flavor" of regex, but I expect to be able to change
title unwanted here.txt
to
title X here.txt
with the very simple
unwanted
to
X

But instead I find I have to use
^(.*)unwanted(.*)
to
\1X\2

OK, so that works, but why not allow substring replacement? (I'm probably missing something pretty obvious...)

Thanks!
Bob
bobkoure
 
Posts: 16
Joined: Mon Jul 10, 2006 5:38 pm

Postby Admin » Thu Jun 07, 2007 3:11 pm

It just hasn't been written that way. The RegExp logic in BRU is designed solely for substring processing, e.g. \1 and \2 logic.


Jim
Admin
Site Admin
 
Posts: 2344
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions