Replace inside a text with certain condition

Tool for Search and Replace across multiple files.
piramidum
Posts: 2
Joined: Wed Jul 24, 2013 6:13 pm

Replace inside a text with certain condition

Post by piramidum »

Sorry, I saw a post seemed to this but I havent very much experience with regex and I dont achieve to translate that case to my case

I want to do that, for instance, with reg ex:
I have this text fragments distributed in a html

href="168417175475895">
href="166317175475895">
href="168417175465295">

and I want Textcrawler transform that in this:

href="168417175475895.html">
href="166317175475895.html">
href="168417175465295.html">

(the number is not important, but I know that there will be numbers and only numbers betwen the "s

(I know that I can to do this with Find: "> and Replace : .html"> in the Standard tab, but with that I obtain too much replaces in other places where I dont want it)

Thank you very much in advance, your software is amazing and it is a very useful tool very well done and very saving time software for many tasks
User avatar
DigitalVolcano
Site Admin
Posts: 1863
Joined: Thu Jun 09, 2011 10:04 am

Re: Replace inside a text with certain condition

Post by DigitalVolcano »

hi
I think this will do it. In regular expression mode-

Code: Select all

RegEx: href="([0-9]*)"
Replace: href="$1.html"
Try it out in the tester first to make sure you are happy with it!

Note - the $1 displays everything captured in the first set of brackets ()
piramidum
Posts: 2
Joined: Wed Jul 24, 2013 6:13 pm

Re: Replace inside a text with certain condition

Post by piramidum »

Thank you very much for your answer, it is very useful for that case and, because you show me as the $ works, for other cases that I could find
Post Reply