I am trying to use a single grep command to search for all instances of $ until a single =
I have the following command so far grep -E '\$.*=' which returns all lines with a $ and then a = but it also returns lines with == which I dont want. I want it to match the lines below
$string = 'content'; (match)
$_array['key']=12; (match)
if ($str == 'pass') (no match)
return $var1==$var2; (no match)
I get my intended results with this command grep -E '\$.*=' | grep -v '==' but I want to make it work with one grep command and no piping
'\$[^=]*=[^=]*$'?$a = ("v"==$b);?'^[^=]*(=[^=]+)*\$[^=]*=([^=]+(=[^=]+)*)?$'Demo I'd explain it but your question was closed for some totaly unknown / bizzarro / obscure reason.. Voting to Reopen !$a='b'; $c='d'?