Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8474703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:41:47+00:00 2026-06-10T17:41:47+00:00

The programmer who wrote the following line probably uses a python package called regex

  • 0

The programmer who wrote the following line probably uses a python package called regex.

UNIT = regex.compile("(?:{A}(?:'{A})?)++|-+|\S".format(A='\p{Word_Break=ALetter}'))

Can some one help explain what A='\p{Word_Break=ALetter}' and -+ means?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:41:48+00:00Added an answer on June 10, 2026 at 5:41 pm

    The \p{property=value} operator matches on unicode codepoint properties, and is documented on the package index page you linked to:

    • Unicode codepoint properties, including scripts and blocks

      \p{property=value}; \P{property=value}; \p{value} ; \P{value}
      

    The entry matches any unicode character whose codepoint has a Word_Break property with the value ALetter (there are currently 24941 matches in the Unicode codepoint database, see the Unicode Text Segmentation, Word Boundaries chapter specifiation for details).

    The example you gave also uses standard python string formatting to interpolate a partial expression into the regular expression being compiled. The “{A}” part is just a placeholder for the .format(A='...') part to fill. The end result is:

    "(?:\p{Word_Break=ALetter}(?:'\p{Word_Break=ALetter})?)++|-+|\S"
    

    The -+ sequence just matches 1 or more - dashes, just like in the python re module expressions, it is not anything special, really.

    Now, the ++ before that is more interesting. It’s a possessive quantifier, and using it prevents the regex matcher from trying out all possible permutations of the pattern. It’s a performance optimization, one that prevents catastrophic backtracking issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a Python programmer who knows a bit of Ruby and PHP as well.
I am a C++ programmer who occasionally uses MySQL to work with databases, but
I'm a self-taught programmer who jumped into Python as my first language about 7-8
I am a totally blind programmer who would like to learn Python. Unfortunately the
It was not me who wrote this code, it was the previous programmer. However,
I am a .NET programmer who needs to port one good Desktop OTP system
I am a Java programmer who learns Haskell. I've written a small program that
I have a programmer who is using VB and LINQ; and I have a
I have another programmer who I'm trying to explain why it is that a
I am a programmer who has programmed in several languages, both functional and OO

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.