How can I remove everything from a string except letters? I have an input field for the first names.
In PHP you can use (as suggested by @rczajka and @mario):
preg_replace('/\PL/u', '', $str)
Working example: http://codepad.viper-7.com/V78skl
You can check this tutorial for regular expression.
$new_string = preg_replace('/[^az]/i','',$old_string);
$new_string = ereg_replace("[^A-Za-z]", "", $string );
Source: https://habr.com/ru/post/896359/More articles:An incomprehensible linker problem with static const class members - c ++Android.App.Activity - package does not exist - javaIs there a reason System dll is different in Silverlight and other C # libraries - c #SVN Checkout in one directory - directoryHow to get a session from a signal handler in Django - djangoClass Method Suppression Not Found Warnings in Xcode - objective-cDifference between array [n] and array []? - c ++Creating a dynamic method in Objective-C - dynamicThe type parameter cannot be used with type arguments - genericsHow to make os.execv () in Python on Windows without disconnecting from the console? - pythonAll Articles