in reply to Strange regex needed

It seems the class could end in a space or ampersand:
$string =~ s/class=([^" &]+)/class="$1"/g;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Strange regex needed
by chromedome (Initiate) on Nov 19, 2014 at 23:41 UTC
    Thank you. I just now realized that it's not just the class= but all elements (border, width, colspan) have the possibility of not having quotes around them. Guess I will go back to the drawing board. Thanks again.
      $string =~ s/\b(class|border|width|colspan)=([^" &]+)/$1="$2"/g;
      Perl is the programming world's equivalent of English