in reply to regex doubt on excluding

You could build your own character class. Something like:
[ \t]
Add whatever else you need to it.

Replies are listed 'Best First'.
Re^2: regex doubt on excluding
by Anonymous Monk on Apr 21, 2014 at 08:40 UTC

    Thank You Laurent.

    So it should be something like this,

    $string =~ s/^[ \t]$//mg;

    but that code is not working for me!

      I am not sure what exactly you are trying to do, but, with the start and end of line anchors, your regex will match only lines which have only exactly one character of the character class and nothing else. You may want to have at least have something like:
      $string =~ s/^[ \t]+$//mg;
      Or maybe you don't want the ^ and $ anchors. Or maybe you don't want the multi-line m modifier. Please explain more precisely what you want to achieve, and give an example input where it does not work the way you wish, together with the output that you are looking for.
        Thnx Laurent