PHP:删除数字块后的文本和数字(包括 - >。< - )

can u help me? I try to create a little function and i dont know how to do it.

String: "GRUNDIG GWN 36630 Waschmaschine"
Output: "GRUNDIG GWN 36630"

Thats work with

$s2 = preg_replace("/([^0-9]*[0-9]*)(.*)/", "$1", $link->plaintext);

But if i have an String with dots inside like: String: "WMF 12.7700.6343 Lingo 24-tlg. Besteck-Set" The Output: "WMF 12"

But it should be WMF 12.7700.6343

I need a script that trim the String at the End of a Number block and not a the first numbers till first dot.

Update: 09.09.2017

sorry i dont know how to works with strackoverflow.

GRUNDIG GWN 36.6-30 Waschmaschine

WMF 12.7700.6343 Lingo 24-tlg. Besteck-Set

GIGASET C 430 A Duo Schnurloses Telefon

Should be:

GRUNDIG GWN 36.6-30 Waschmaschine WMF 12.7700.6343 Lingo 24-tlg. GIGASET C 430 A Duo

  1. all words before a numer combination (ex. 19.23-2329)
  2. after the words combination only add 2 words

GIGASET C 430 A Duo

Actually you just have to search for (^.+?([0-9.-]+)).* and replace it with $1. That's it.

Here's a working live example with both of your strings: https://regex101.com/r/6fLvpk/2