[X-Unix] Grep and backreferences with BBEdit

Nick Scalise nickscalise at mac.com
Tue Oct 12 11:12:25 PDT 2004


Hello,

I do not have a strictly unix question. I am very weak at grep and could use some rudimentary help.

In BBEdit 6.5, I am wanting to do a search and replace for all occurances of <a href="name.jpg">, where 'name' is the variable. I want to add a images/ to the beginning of the 'name' variable.

So, I think I have the first part figured out, I find <a href="[a-zA-Z0-9+]+.jpg"> using grep in BBEdit's find dialog, this seems to produce the desired result. Please let me know if there is a better way.

Where I am lost is the backreference part. What is the pattern I would add in the replace dialog that would add 'images/'  so that the original <a href='name.jpg'> would end up <a href="images/name.jpg">

TIA
--
Nick Scalise
nickscalise at mac.com


More information about the X-Unix mailing list