i want to replace some parts in a file by dreamweaver using the search and replace function with reg ex. How I can I specify this part:
<lastmod>2011-01-13T14:57:31+00:00</lastmod>
Is there any way to make this:
redirect301 http://www.mypage.com/this/that/
to
redirect301 hhttp://开发者_StackOverflowwww.mypage.com/this/that/ http://www.mypage.com/this/that/lang/en/
Many Thanks in advance, Cindy
If I understand correctly, you would want to search for <lastmod>([^<]*)</lastmod>
to get the full lastmod
tag.
As far as I understand regexes, this selector means "everything that is not the character <
", so it assumes there will be no tags nested inside the lastmod
. The parentheses are optional, but they allow you to refer to the matched string when replacing, like in the next case. Replace
redirect301 http://www.mypage.com/([\S]*)/
with
redirect301 http://www.mypage.com/$1/ http://www.mypage.com/$1/lang/en/
to pass the mathching this/that
to the $1
variable. The regex matches all non-whitespace characters. I'm not sure how to account for missing trailing slashes, so watch out for inconsistencies. Hope it helps.
精彩评论