正则表达式失败

I have this text:

/**
 * @var \guervyl\cbind_attr_testBundle\Entity\Category
 *
 * @ORM\ManyToOne(targetEntity="guervyl\cbind_attr_testBundle\Entity\Category", inversedBy="song")
 * @ORM\JoinColumns({
 *   @ORM\JoinColumn(name="category_id", referencedColumnName="id")
 * })
 */
private $category;

/**
 * @var \guervyl\cbind_attr_testBundle\Entity\User
 *
 * @ORM\ManyToOne(targetEntity="guervyl\cbind_attr_testBundle\Entity\User", inversedBy="song")
 * @ORM\JoinColumns({
 *   @ORM\JoinColumn(name="user_id", referencedColumnName="id")
 * })
 */
private $user;

I want to get that part to edit:

* @ORM\ManyToOne(targetEntity="guervyl\cbind_attr_testBundle\Entity\Category", inversedBy="song")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="category_id", referencedColumnName="id")
     * })
     */
    private $category;

I have that expression that stop on the $: (\*.*@ORM\\ManyToOne\(.*)(\)(?:\s|.)*?private \$)

But when I try to select the rest category;, when I set the c I got no match (timeout): (\*.*@ORM\\ManyToOne\(.*)(\)(?:\s|.)*?private \$c)

I want that regex to work: (\*.*@ORM\\ManyToOne\(.*)(\)(?:\s|.)*?private \$category;)

What's wrong with my Regex?

The matching pattern could be:

.*ManyToOne(.|
)*category;

The pattern means:

.*           Match anything zero or more times
ManyToOne    Literally match "ManyToOne"
(.|
)*      Match anything (including line breaks) zero or more times
category;    Literally match "category;"

The resulting match would be:

 * @ORM\ManyToOne(targetEntity="guervyl\cbind_attr_testBundle\Entity\Category", inversedBy="song")
 * @ORM\JoinColumns({
 *   @ORM\JoinColumn(name="category_id", referencedColumnName="id")
 * })
 */
private $category;

Fiddle: Live Demo

You're trying to get comments out of a PHP file using regex? Not sure if you're aware, but PHP includes functions for parsing the language which allow you to grab the comments (and other parts of the code) very easily without any regex at all.

The function you're looking for is token_get_all(), and you can get some example code that does exactly what you want from this answer here on SO.