php preg_split functionality
is there a way to understand the following logic contained in the splitting pattern:
preg_split("/[\s,]+/", "hypertext language, programming");
in the grand scheme of things开发者_Python百科 i understand what it is doing, but i really want a granular understand of how to use the escapes and special character notation. is there a granular explanation of this anywhere? if not could someone please provide a breakdown of how this works. it is something very useful, and something i would like to have completely under in my belt so to speak.
+ means 1 or more
[\s,] means a space and/or comma character
This will split the text by 1 or more spaces and commas together
definitely read http://www.regular-expressions.info/ as Silfverstrom recommended. Also what helped me learn was this game: http://www.javaregex.com/agame.html
you should have a look at regular expressions, this might be a good place to start http://www.regular-expressions.info/reference.html
精彩评论