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 832805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:25:09+00:00 2026-05-15T04:25:09+00:00

This should be easy, but I’ve managed to stump 2 people so far at

  • 0

This should be easy, but I’ve managed to stump 2 people so far at work & I’ve been at it for over 3 hours now, so here goes.

I need to replace a+ with aplus (along with a few other cases) with the Python re module.
eg. “I passed my a+ exam.” needs to become “I passed my aplus exam.”

Just using \ba+ works fine most of the time, but fails in the case of a+b, so I can’t use it, it needs to match a+ as a distinct word. I’ve tried \ba+\b but that fails because I assume the + is a word boundary.

I’ve also tried \ba+\W which does work, but is greedy and eats up the space (or any other non-alpha char that would be there).

Any suggestions please?

  • 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-05-15T04:25:09+00:00Added an answer on May 15, 2026 at 4:25 am

    Turn that \W into an assertion.

    \ba\+(?=\W)
    

    or, better,

    \ba\+(?!\w)
    

    since the negative assertion allows matching the a+ at end of string too.

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

Sidebar

Related Questions

OK this should be easy but I can't seem to get it to work.
I am sure this should be easy but I ahve been going crazy trying
This should be easy, but I'm not sure how to best go about it.
This should be easy for many of you, but for me it's just another
I think this should be easy, but it's evading me. I've got a many-to-many
This should be a simple question, but I haven't been able to find a
This should be easy but for some reason it isn't working. I wanted to
I must be just having a moment, because this should be easy but I
This should be pretty easy but I'm having a heck of a time doing
Good afternoon, This should be an easy one. I've done the cookie-cutter default ASP.NET

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.