In php, what if I want to split the strings before and after e? Like this: abcde1234 is converted to abcd1234. in php, what should I do if I want to split the strings before and after e?
Like this:
Abcde1234 to abcd 1234
Tom for help...
Reply content: in php, what should I do if I want to split the strings before and after e?
Like this:
Abcde1234 to abcd 1234
Tom for help...
Simple Regular Expression
$ Str = "abcde1234 ";
Preg_match ('/^ (\ w +) e (\ d +) $/I', $ str, $ matches );
Print_r ($ matches );
Array
(
[0] => abcde1234
[1] => abcd
[2] => 1234.
)
Explode () function http://www.w3school.com.cn/php/func_string_explode.asp
Abcd [1] => 1234)
Online Demo: http://3v4l.org/k7Dap
Support upstairs. You can also use strpos to find the location and use substr to crop it. For detailed usage, see the manual. Let's see what you think.
Regular Expressions can also achieve more complex segmentation.