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

  • SEARCH
  • Home
  • 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 8515267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:06:04+00:00 2026-06-11T05:06:04+00:00

I read some posts here but they couldn’t help me figure out my issue:

  • 0

I read some posts here but they couldn’t help me figure out my issue:

you can read the below regexp which is trying to match the a place with excluding a specific string”Profile Pictures”.I wanted match all other cases if the beginning string of the expression is not “Profile Pictures”, but it doesn’t work:

re.compile(r"(?!Profile Pictures)</strong></a><div class=\"photoTextSubtitle fsm fwn fcg\">(\d+) photos</div>")

The matched numbers(\d+) are returned,but “Profile Pictures” is still counted as one of them.
I tried different ways but none of them works.However, I still feel negative lookahead is the way to solve it. Any ideas?
Thank you!

  • 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-11T05:06:06+00:00Added an answer on June 11, 2026 at 5:06 am

    You’re using (?!... or a negative lookahead assertion which according to the python regex documentation

    Matches if … doesn’t match next. This is a negative lookahead assertion. For example, Isaac (?!Asimov) will match ‘Isaac ‘ only if it’s not followed by ‘Asimov’.

    In this case what you want is (?<!... which is a negative lookbehind assertion. This is because you’re trying to avoid matching text that comes before the text you want to match, not after. From the regex docs:

    Matches if the current position in the string is not preceded by a match for …. This is called a negative lookbehind assertion. Similar to positive lookbehind assertions, the contained pattern must only match strings of some fixed length. Patterns which start with negative lookbehind assertions may match at the beginning of the string being searched.

    That’d give you a regex that looked like this instead:

    re.compile(r"(?<!Profile Pictures)</strong></a><div class=\"photoTextSubtitle fsm fwn fcg\">(\d+) photos</div>")
    

    Of course, it’s difficult to test this without some examples from you.

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

Sidebar

Related Questions

I have read some posts on here about not mixing parameters when passing into
I have already read some posts, but no one helped me with my problem.
I've read some posts stating that using this method is not good, shouldn't be
I have read some posts having the same problem. I tried to adapt their
Today I read some posts about the 'autocomplete' browser generated in the text fields,
I have read some posts about this topic and the answers are comet, reverse
I've read some posts where a php file opens and writes the info to
I'm not familiar with Capistrano at all, I've just read some basic posts about
Using ruby-1.9.3... I've read some of the canonical blog posts on the subject of
i've just read a few posts on hiding Silverlight code in some way. Main

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.