anilmuthineni / foxreplace

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

Regex replacing #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
You have regex search but you don't have regex replacing as shown in this link: 
http://www.funduc.com/regexp.htm

It's kinda lacking since regex is supposed to be used to search for a string 
and furthermore allow for a minor adjustment within the searched string while 
leaving the rest of the search string alone.

Example:
1. search specifically for: [0-9]Chariot[A-Z]
2. Want to replace just "Chariot" only when search condition is met.
3. regex replace function should be: %1Replace_Term%2

See the link above to understand what %n does in replace string, "n" being the 
number.

It doesn't work as it should and replaces search string with "%1Replace_Term%2" 
as is.

I'd like if the regex replace functionality was added as soon as possible.

Otherwise regex functionality is only half complete.

Original issue reported on code.google.com by jedi200...@gmail.com on 4 Oct 2012 at 11:09

GoogleCodeExporter commented 9 years ago
Even the $n function, mentioned in Foxreplace Help, isn't working.
It replaces with the raw "$n" string, where n is the number.
Same as with the "%n".

BTW I'm using Firefox 15.0.1, just to let you know.

Original comment by jedi200...@gmail.com on 4 Oct 2012 at 11:23

GoogleCodeExporter commented 9 years ago
$` and $' are working though. They properly insert the data before and after 
respectively

Original comment by jedi200...@gmail.com on 4 Oct 2012 at 11:28

GoogleCodeExporter commented 9 years ago
$n is working correctly, but it refers to subexpressions between parentheses, 
i.e. what you need is "([0-9])Chariot([A-Z])" -> "$1Replace_Term$2".

But reading the explanation in the help file, I admit that it is unclear, so 
I'll try to improve the explanation.

Original comment by marc.r...@gmail.com on 5 Oct 2012 at 10:52

GoogleCodeExporter commented 9 years ago
Can you also explain how to use regex backtracking? 
http://www.regular-expressions.info/brackets.html

For example there is the text "x- x" where x can be any letter or letters

I want to use regex to remove the space and make it "x-x"

According to all the regex tutorials on the net, I should use something like 
"([A-Za-z])- \1" where \1 is the backtracker.

Also I've read that there are regex replacement expressions for changing the 
case of the text. Is that also available?

We really need a better explanation on regular expressions in the help file. Go 
throuigh the links in the page linked above and please tell what we can and 
cannot do and how.

Original comment by jedi200...@gmail.com on 16 Nov 2012 at 2:27

GoogleCodeExporter commented 9 years ago
The expression you use for the backtracker is correct (although I didn't know 
of this feature until now). As for your second question, about expressions to 
change case, these aren't available, as far as I know. The supported regex 
syntax is the same as in JavaScript (I just create a RegExp object with the 
text in the input field), which is explained in the link in the help file, but 
maybe I should make it more clear.

Original comment by marc.r...@gmail.com on 16 Nov 2012 at 6:15

GoogleCodeExporter commented 9 years ago
Done in r164.

Original comment by marc.r...@gmail.com on 17 Nov 2012 at 11:52