'PHP Regex: How to match the word before dash? [duplicate]

Here's my code, but it's not working. How can I match the word before dash?

$str = '-Lorem Ipsum is simply dummy- text of the printing';
preg_match('/(.*)\-/', $str, $matches);

Expected Output: dummy

Thanks a lot for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source