In my code below, I am trying to extract scalar string data from HTML using a regular expression. I should end up with $message eq '"This is the message."' (please note that the double-quotes should be included in the string) and $sender eq "sender". For some reason that I can't figure out, I always get an empty string in each scalar variable. Please point out the error of my ways....
$data = qq/{"message":"This is the message.","sendAs":"sender"}/; ( $message, $sender ) = $data =~ /\{"message":("[^"]"),"sendAs":"([^"] +)"\}/;
In reply to Regular expression not working by oakb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |