1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

compatible attributes

Discussion in 'Perl' started by abhisheksainiabhishe, Jun 11, 2008.

  1. abhisheksainiabhishe

    abhisheksainiabhishe New Member

    Joined:
    Jun 10, 2008
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    If I have want to combine tags with compatible attributes like...

    <font color="blue" font="Times"><font size="14"abcdegh</font></font>

    to

    <font color="blue" font="Times" size="14"abcdegh</font>

    as I have have it all in one scalar variable

    I thoughtI would have something like..

    my $startFontTag="<font";
    my $endFontTag="</font>";

    $string =~ s/$startFontTag[\w*|\s*|\S*]$startFontTag[\w*|\s*|\S*]/$1/gi;

    but I dont think the above approach is going to work.

    Should I do something like first check the string to see if any occurence of
    </font></font> occurse then delete one of them and move back to check staring font tasg
    and to combine them.

    Thanks!
     
  2. abhisheksainiabhishe

    abhisheksainiabhishe New Member

    Joined:
    Jun 10, 2008
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    i got it working.
    will post the part of code some time.
    this thread can be closed now.
    thanks!
     

Share This Page