php - preg_split() help, properly formatted regular expression -


I am very weak in regular expressions

I want to split these letters on:

  • Location ""
  • The hyphen "
  • Underscore" _ " < P> I have it:
      preg_split ('/ \ + | - | \ | | _ /', $ string],   

    .. I suspect this is not correct - I like some advice on the "+" sign.

    < Code> preg_split ('/ [+ \ s _-] /', $ string); should work for you Unlike the squares, the characters are creating a character square.

    Note - It is sometimes important that - , So I keep it always kept safe.

  • Comments

    Popular posts from this blog

    excel vba - How to delete Solver(SOLVER.XLAM) code -

    github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

    ios - Replace text in UITextView run slowly -