#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Location
    Lakewood, WA
    Posts
    218
    Rep Power
    17

    Can someone explain this expression to me?


    Can someone please dissect and explain this to me:

    /^\pL+$/u

    The description says it filters alpha only, but I don't understand what's going on...

    - Thanks!
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,435
    Rep Power
    9645
    For an automated explanation, regex101.com has a thing for that.

    ^ is the beginning of string,
    \pL represents anything that's considered to be a "letter" in Unicode,
    + to repeat,
    $ for the end of the string,
    and /u to interpret the input string in UTF-something mode (which is UTF-8 in PHP).

    Comments on this post

    • Azumi93 agrees : Kudos for regex101

IMN logo majestic logo threadwatch logo seochat tools logo