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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:24:24+00:00 2026-05-22T18:24:24+00:00

This is driving me insane. I’m trying to find every instance of DOI or

  • 0

This is driving me insane.

I’m trying to find every instance of “DOI” or it’s mis-scanned equivalents in a series of documents. I then want to collect the term “DOI” and up to 15 alpha numeric characters that should come after it. But I also need to ensure I find these even if they overlap with a previous match.

I’ve tried to extrapolate this previous solution I was given to another similar problem but with no success.

Python regex find all overlapping matches?

Here is the example I’m using to test this.

String to search :

"abhgfigDOI567afkgD0Idhdhfhfhdbvbkab3343432q3DO1fbaguig7ggkgafgkgDOIDOID01OO1"

DOI variations:

DOI|DO1|D01|D0I|001|00I|0O1|0OI|O01|O0I|OO1|OOI

Expected results:

["DOI567afkgD0Idhdhf",
"D0Idhdhfhfhdbvbkab",
"DO1fbaguig7ggkgafg",
"DOIDOID01OO1",
"DOID01OO1",
"D01OO1",
"001"]

Any assistance would be most appreciated!

Thanks!

  • 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-22T18:24:25+00:00Added an answer on May 22, 2026 at 6:24 pm

    Using the “DOI variations” DOI|DO1|D01|D0I|001|00I|0O1|0OI|O01|O0I|OO1|OOI literally in that form is not a good idea. Start from basics: D+0+O, O+0, and I+1. This leads immediately to the pattern “[D0O][O0][I1]” which is much more compact, less error prone, and capable of much faster execution (if you wanted to get into Cython or C).

    You can then IN THIS CASE use re.finditer() to find matching 3-character prefixes, and take it from there.

    In a more general case e.g. the lead tag should be DOD instead of DOI, you can’t use re.finditer():

    Input text:     DODOD987654321
    First match:    DODOD987654321
    Second match:     DOD987654321 # Not found by re.finditer()
    

    In the most general case (e.g. lead tag is DDD), you need to do re.search() in a loop, incrementing the search-start position by only 1 place after a successful match.

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

Sidebar

Related Questions

This is driving me insane. I'm trying to INSERT a value into the following
This has been driving me insane for about the last hour. I'm trying to
This is driving me insane. I am trying to get a basic Report to
This is driving me insane. I am trying to grab an object in javascript
This is driving me insane. I am trying to select a DOM element by
This is driving me farking insane. I'm trying to create a simple beginner app
This is driving me insane. I'm trying to change the panels when you click
This is driving me insane. The Maven failsafe plugin will not run on my
Any help most appreciated, this is driving me insane. I'm doing exactly what I
This is driving me absolutely insane. I know that, to change the formatting of

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.