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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:05:58+00:00 2026-06-08T18:05:58+00:00

Here is the pattern pattern_strings = [‘\\xc2d’, ‘\\xa0’, ‘\\xe7’, ‘\\xc3\\ufffdd’, ‘\\xc2\\xa0’, ‘\\xc3\\xa7’, ‘\\xa0\\xa0’, ‘\\xc2’,

  • 0

Here is the pattern

pattern_strings = ['\\xc2d', '\\xa0', '\\xe7', '\\xc3\\ufffdd', '\\xc2\\xa0', '\\xc3\\xa7', '\\xa0\\xa0', '\\xc2', '\\xe9']
join_pattern =  '[' + '|'.join(pattern_strings) + ']'
pattern = re.compile(join_pattern)

Here is the function

def find_pattern(path):
    with open(path, 'r') as f:
        for line in f:
            # print line
            found = pattern.search(line)
            if found:
                print dir(found)
                logging.info('found in line - ' + line)
                logging.info('found - ' + str(found.group(0)))

Here is the input

\xc2d 
d\xa0 
\xe7 
\xc3\ufffdd 
\xc3\ufffdd 
\xc2\xa0 
\xc3\xa7 
\xa0\xa0 
'619d813\xa03697' 

When I run this, I get output as

INFO:root:found in line - \xc2d 

INFO:root:found - d
INFO:root:found in line - d\xa0 

INFO:root:found - d
INFO:root:found in line - \xc3\ufffdd 

INFO:root:found - u
INFO:root:found in line - \xc3\ufffdd 

INFO:root:found - u
INFO:root:found in line - '619d813\xa03697' 

INFO:root:found - d

Question
– Why doesn’t it tells the entire pattern like \xc2d? am I doing something incorrect here?
– What is that I need to do in order to get the pattern matched like \xc2d instead of d

UPDATE

chaging to join_pattern = '(' + '|'.join(pattern_strings) + ')' doesn’t matches anything

UPDATE 1

pattern_strings = ['\\xc2d', '\\xa0', '\\xe7', '\\xc3\\ufffdd', '\\xc2\\xa0', '\\xc3\\xa7', '\\xa0\\xa0', '\\xc2', '\\xe9']

join_pattern =   '|'.join(pattern_strings)
pattern = re.compile(join_pattern)

This doesn’t matches anything in input 🙁

  • 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-08T18:05:59+00:00Added an answer on June 8, 2026 at 6:05 pm

    Square brackets in re denotes a set

    join_pattern = '[' + '|'.join(pattern_strings) + ']' causes the regex to match “any one of the set of characters in { \ x c 2 d a 0 e 7 3 u f 9 | }“. This is probably not the behavior you want. For the expression you want just use:

    join_pattern = '|'.join(pattern_strings)
    

    No need for parentheses, unlesss you are trying to specify capture/non-capture groups.

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

Sidebar

Related Questions

I have a pattern compiled as pattern_strings = ['\xc2d', '\xa0', '\xe7', '\xc3\ufffdd', '\xc2\xa0', '\xc3\xa7',
I have seen generic repository pattern here . I am trying to add generic
We're using the MVP design pattern here, and we've gone with the presenter-per-UserControl style.
I'm trying to introduce dependency injection (DI) as a pattern here at work and
I've implemented the attached command behavior pattern found here and it works well to
Here is the way I typically see the Abstract Factory Pattern shown: public abstract
I'm learning decorators and here I'm trying to change the below to decorator pattern.
I have some strings to check against a Regex pattern. Here is the regex:
Here is my @Pattern annotation. I want to disallow digits that repeat 9 times.
Question over here is are design patterns specific to a programming language or technology,

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.