Regular Expressions in Macromedia HomeSite 5.2

  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada

Post 3+ Months Ago

Finding regular expression matches in HomeSite using Extended Find works great. I can, for example, match any <meta name="keywords"> line like this:

Code: [ Select ]
<meta name=\"keywords\"[[:print:]]+\">


What doesn't work is using regular expressions in Extended Replace to find a patter and replace it with a pattern + "additional text".

Is this a dead end?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

It works perfectly to me:
Code: [ Select ]
Find: src\=\"([a-z\.]+)\"

Replace with: src\=\"/new_path/\1\"
  1. Find: src\=\"([a-z\.]+)\"
  2. Replace with: src\=\"/new_path/\1\"


\1 is the matched string of the first group ()

Results in:

Code: [ Select ]
<img src="my_file.png">

to

<img src="/new_path/my_file.png">
  1. <img src="my_file.png">
  2. to
  3. <img src="/new_path/my_file.png">
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada

Post 3+ Months Ago

Excellent! Thank you. Now, how about a regular expression that replaces the HomeSite manual with a better one? ;-)

Cheers
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

:D hahahaha
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada

Post 3+ Months Ago

Hey Leo, thanks again. You wouldn't believe how much help that was. I'm regex switching things all over my web site (it has 1000's of files... 1000's!).
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

I'm glad it helped you. I use them often to such correction tasks.

I think regular expressions are one of the best features of the HomeSite software.

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 63 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.