Re: Perl script does not work



CSUIDL PROGRAMMEr wrote:
It changes the following pattern in xml files

<!CDATA[slaaam]]> TO

<slaaam>

But it does not work. Any reasons

Yes, the regex doesn't match.

$line =~ s/<!\[CDATA\[([^\]]*)\]\]>/$1/ig;
----------------------^^

Try

$line =~ s/<!CDATA\[([^\]]*)\]\]>/<$1>/ig;
--------------------------------------^--^

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: Strange Error
    ... >Gunnar Hjalmarsson wrote: ... >> what you are trying to do, i.e. using symbolic references, is ... We've used this type of coding scheme before with no ... one of the reasons why :-) ...
    (perl.beginners)
  • Re: MAIL recommendation
    ... > Do these answers for mail work if I am on windows? ... Portability is one of the reasons why using a module is better than ... Gunnar Hjalmarsson ...
    (comp.lang.perl.misc)