[TriPython] Regular Expressions

Jon Alligood j.alligood47 at gmail.com
Tue Nov 8 09:42:42 EST 2016


Quick question: are you using re?

The re module in python doesn't support \p{L} sadly. You will have to
install the regex package (https://pypi.python.org/pypi/regex/2016.10.22)
which should have the support for the full unicode letter search.

Cheers,
Jon

On Tue, Nov 8, 2016 at 8:52 AM, Luis Valencia <livalencia at my.waketech.edu>
wrote:

>    Hello all,
>
>    I have the following regex pattern for matching: "^[0-9\p{L} _\.]+$". I
>    can use this to match if someone's  name does not match the said
>    pattern before making a call to the API.
>
>    The documentation states the following:
>
>    "The full set of allowed characters across  regions includes any visible
>    Unicode letter characters, digits (0-9), spaces, underscores, and
> periods.
>    Other than that, no punctuation characters are allowed. Thus, the
> regular
>    expression to use for validating summoner names would be "^[0-9\p{L}
>    _\.]+$". You should be rejecting inputs that don't match this regular
>    expression (i.e., that contain any punctuation characters other than
>    periods, underscores, and spaces), rather than sending them to the API."
>
>    When I try to test and type any punctuation characters other than
> periods,
>    underscores, and spaces the pattern fails to recognize them.
>
>    Any regex experts that could point me in the right direction. I am
> perhaps
>    not understanding this correctly, and an explanation would be greatly
>    appreciated.
>
>    All the best,
>
>    Luis
>
> _______________________________________________
> TriZPUG mailing list
> TriZPUG at python.org
> https://mail.python.org/mailman/listinfo/trizpug
> http://tripython.org is the Triangle Python Users Group
>
-------------- next part --------------
   Quick question: are you using re?
   The re module in python doesn't support \p{L} sadly. You will have to
   install the regex package
   ([1]https://pypi.python.org/pypi/regex/2016.10.22) which should have the
   support for the full unicode letter search.
   Cheers,
   Jon
   On Tue, Nov 8, 2016 at 8:52 AM, Luis Valencia
   <[2]livalencia at my.waketech.edu> wrote:

        Hello all,

        I have the following regex pattern for matching: "^[0-9\p{L}
     _\.]+$". I
        can use this to match if someone's  name does not match the said
        pattern before making a call to the API.

        The documentation states the following:

        "The full set of allowed characters across  regions includes any
     visible
        Unicode letter characters, digits (0-9), spaces, underscores, and
     periods.
        Other than that, no punctuation characters are allowed. Thus, the
     regular
        expression to use for validating summoner names would be "^[0-9\p{L}
        _\.]+$". You should be rejecting inputs that don't match this regular
        expression (i.e., that contain any punctuation characters other than
        periods, underscores, and spaces), rather than sending them to the
     API."

        When I try to test and type any punctuation characters other than
     periods,
        underscores, and spaces the pattern fails to recognize them.

        Any regex experts that could point me in the right direction. I am
     perhaps
        not understanding this correctly, and an explanation would be greatly
        appreciated.

        All the best,

        Luis

     _______________________________________________
     TriZPUG mailing list
     [3]TriZPUG at python.org
     [4]https://mail.python.org/mailman/listinfo/trizpug
     [5]http://tripython.org is the Triangle Python Users Group

References

   Visible links
   1. https://pypi.python.org/pypi/regex/2016.10.22
   2. mailto:livalencia at my.waketech.edu
   3. mailto:TriZPUG at python.org
   4. https://mail.python.org/mailman/listinfo/trizpug
   5. http://tripython.org/


More information about the TriZPUG mailing list