如何在正则表达式中用空格和数字来拉?

I have following couple of lines:

  • The Great Gatsby (1925) by F. Scott Fitzgerald is a short novel which takes.
  • Fight Club is a 1996 novel by Chuck Palahniuk.

I have to pick writer name that comes after by and year it was written; 1925 and 1996 respectively. What I figured, I need a couple of RegEx; one for picking numbers only by doing \d+ and other for picking writer name. For Writer I made this regex(https://regex101.com/r/Z55yz3/1) but it is not working as it should due to presence of . and space.

[0-9]{4} - takes 4-digits number

\bby - gets word 'by' and

(?:\s+[A-Z][\w.]+)+- selects following words and abbreviations, beginning with uppercase letter

([0-9]{4}).*(?:\bby)((?:\s+[A-Z][\w.]+)+)

Demo and explanation

you can use this regex /^.+?\ BY (.+)$/is like this

$string_text = 'The Great Gatsby (1925) by F. Scott Fitzgerald is a short novel which takes.';
preg_match("/^.+?\ BY (.+)$/is" , $string_text, $match);
echo $match[1];