vessillo / foxreplace

Automatically exported from code.google.com/p/foxreplace
0 stars 0 forks source link

Add Variable in substitutions #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I would like to be able to match some HTML string with a regexp keeping
some of the text in the middle and forward to the output

Here a trivial example.
If I want to match something like:
http://code.google.com/u/mometto/

and replace it with 
http://anotherwebsite.com/mometto

I can only do it with a specific user, not a generic one.

What version of the product are you using? On what operating system?
0.10.0

Original issue reported on code.google.com by mome...@gmail.com on 21 Jun 2009 at 12:36

GoogleCodeExporter commented 9 years ago
You can do this with parentheses and $1, $2... See
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Working_with_Regular_
Expressions/Using_Parenthesized_Substring_Matches

For example you can do:
Input type: RegExp
Replace: http://code.google.com/u/(mometto)/
With: http://anotherwebsite.com/$1
Result: http://anotherwebsite.com/mometto

Original comment by marc.r...@gmail.com on 22 Jun 2009 at 10:16

GoogleCodeExporter commented 9 years ago
Yes that was exactly what I wanted! Thanks, you can close this bug then (well 
not a 
bug here.. :-))

Original comment by mome...@gmail.com on 22 Jun 2009 at 2:49

GoogleCodeExporter commented 9 years ago

Original comment by marc.r...@gmail.com on 24 Jun 2009 at 11:15