php - Return characters up to first nonalphanumeric character -


i want obtain part of string until first non-alphanumeric character. currently, have following strings show.

go forty go (ire) 471    -> go forty go pearl noir 15528258 d3   -> pearl noir synonym (ity) 1793158-00 d1   -> synonym 

in above cases, want pull characters before either number or (.

do mean this:

$repl = preg_replace('/\h*[^ a-za-z].*$/', '', $input); go forty go pearl noir synonym 

btw removing after first non-alphabetic+non-space character.

regex demo


Comments