P
P
ProstoDesign2010-09-29 12:18:42
Regular Expressions
ProstoDesign, 2010-09-29 12:18:42

Replacing code in Dreamweaver using a regular expression

There is a database dump, 10 megabytes in size, in which there are about 7000 similar lines:



Нужно эти строки удалить, однако не понял как это сделать, ведь url в ссылках разный, а с регуляркой у меня почему-то не получилось подружиться в данном аспекте.

Помогите, кто может) Можно в любом другом IDE.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nikitammf, 2010-09-29
@ProstoDesign

<a.+onclick="return hs\.expand\(this\)".*>[\s\S]*</a>

E
Eugene, 2010-09-29
@Nc_Soft

in dream ctrl+f
find


<a[^<]+>(.+)</a>

replace with $1
(don't forget the regular expression checkbox)

P
pmb_it, 2010-09-29
@pmb_it

For example, like this:


#! perl -w
onclick="return hs.expand(this)">

open F, 'myfile'; @f=<F>; close F; 
open F, '>output_file'; 
foreach $str (@f) { 
  print F $str if $str !~ /\<a\shref\=\"www\.comgun\.ru\/uploads\/posts\/.+\.jpg\"\sonclick\=\"return\shs\.expand\(this\)\"\>/ 
} 
close F; 

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question