 |
 |
Tag Selection
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
I have long since forsaken Dreamweaver in favor of hand-coding and I'm very happy with that decision; however, one feature of DW I miss is the ability to search/select/replace entire tags (without selecting anything inside the tag), including the closing tag when needed. Is there any other program that does this? I don't see a way to do it in TextWrangler. I also seem to recall that you can also search/select/replace HTML/XML attributes as well -- very useful in Web development.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
|
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
Originally Posted by Chuckit
TextMate?
Yes, but Textmate costs £39 ($77.28 US), and TextWrangler is free.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Actually, TextMate costs €39, which is about $50. Anyway, you didn't ask about prices; you asked what program could do it. TextWrangler can't do it as far as I am aware, so I didn't mention that.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
Originally Posted by Chuckit
Actually, TextMate costs €39, which is about $50. Anyway, you didn't ask about prices; you asked what program could do it. TextWrangler can't do it as far as I am aware, so I didn't mention that.
Of course, you're right, no problem. I blew it -- it was Euros, not pounds sterling -- my bad. But price is a factor for me as my thinking on this evolves.
(Last edited by selowitch; May 23, 2007 at 02:56 PM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2006
Status:
Offline
|
|
How much is Dreamweaver though? Seems like TW would be a cheap option.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status:
Offline
|
|
Doesn't TextWrangler support regexes? I'd be surprised if it doesn't.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
Originally Posted by Mithras
Doesn't TextWrangler support regexes? I'd be surprised if it doesn't.
It does, but search strings for locating tags aren't predefined, and I don't think you can simultaneously select more than one noncontiguous string. For example, for this code:
[codex]<a href="/somelink/">Some anchor text</a>[/codex]
I'd like to search/select/replace this:
[codex]<a href="/somelink/">[/codex]
and this:
[codex]</a>[/codex]
at the same time, without selecting
[codex]Some anchor text[/codex]
... which is what DW can do just by double-clicking.
Originally Posted by peeb
How much is Dreamweaver though? Seems like TW would be a cheap option.
I don't care. I wouldn't go back to DW if Adobe paid me.
(Last edited by selowitch; May 23, 2007 at 03:54 PM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2006
Status:
Offline
|
|
I don't care. I wouldn't go back to DW if Adobe paid me.
Well sure, it just seemed that if you could afford DW, you could probably shell out the fifty bucks for TW.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Regexp for replacing the tag should be something like:
Find: <(tagname) restoftag>(.*)</\1>
Replace: <replacementtag>\2</replacementtag>
Insert the tag you want to replace where "tagname" is (including parens), the rest of the tag where restoftag is and the replacement tag…well, you get it.
It's not really a ridiculously elegant solution, but it will replace all occurrences of a tag without messing up your text.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
Originally Posted by Chuckit
Regexp for replacing the tag should be something like:
Find: <(tagname) restoftag>(.*)</\1>
Replace: <replacementtag>\2</replacementtag>
Insert the tag you want to replace where "tagname" is (including parens), the rest of the tag where restoftag is and the replacement tag…well, you get it.
It's not really a ridiculously elegant solution, but it will replace all occurrences of a tag without messing up your text.
Thanks. That's very helpful!
Originally Posted by peeb
Well sure, it just seemed that if you could afford DW, you could probably shell out the fifty bucks for TW.
Surely you mean TM. And I already have DW, but I don't like to use it ever, because it messes up and fattens my code.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status:
Offline
|
|
Though you'd probably want that to be
[codex]<(tagname) restoftag>([^<]*)</\1>[/codex]
or (if it supports Perl-style nongreedy regexes)
[codex]<(tagname) restoftag>(.*?)</\1>[/codex]
...since otherwise you'll swallow everything between the first <a> and last </a>, which is probably not what you want...
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
The first option there will break on any element that's not completely simple (<i><b></b></i>, for example, could not replace the I tags). The non-greedy version works, and is in fact what I meant to do. Though both versions seem to be non-greedy in TextWrangler anyway.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|