remove
's from the end of a string

请求翻译

as the title says i have a string like this:

$string = "Hello World
hello world

";

now i want to get rid of the
s at the end of this string so it looks like this:

$string = "Hello World
hello world";

I tried this:

preg_replace('/^(
)*/', "", $string);

but this did not work. maybe someone knows the right regex.

greetings peter

6个回答