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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:57:50+00:00 2026-05-28T03:57:50+00:00

I somehow know that the answer to this question will be obvious, but I’ve

  • 0

I somehow know that the answer to this question will be obvious, but I’ve spent several days trying unsuccessfully to find out why I don’t seem to be able to find the reg.exp. mach object in the script below.
Here’s the error messsage I get:

    subject:     Re: Why DOJ BMFEA Baton Rouge rejected Gonzalaz Pen Code 99999 death case


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Traceback (most recent call last):
  File "C:\Apps\UtilitiesByMarc\test_search4Sender_aaB.py", line 46, in <module>
    print fn_cull_sender_info(date_string_raw)
  File "C:\Apps\UtilitiesByMarc\test_search4Sender_aaB.py", line 35, in fn_cull_sender_info
    print 'Line 35:  matchObj found\n str(match_obj.group(0)) = ' +  str(match_obj.group(0))
NameError: global name 'match_obj' is not defined

The following is the code:

import sys
import re, pdb
#pdb.set_trace()

def fn_get_srctxt_hg_datestring_rawdata_from_clipbd(): 
    this_scriptz_FULLName = sys.argv[0]
    try:
        date_string_raw = sys.argv[1]
        return returnval    
    except:
        date_string_raw = ''

        import win32clipboard

        win32clipboard.OpenClipboard()
        clip_text = win32clipboard.GetClipboardData()
        win32clipboard.CloseClipboard()    

        date_string_raw = clip_text
        returnval = clip_text
        return returnval    




def fn_cull_sender_info(date_string_raw): # 
    # Do re replacements
    import re
    sender_info = 'Line 29 empty'
    print '\n\nLine 30:  date_string_raw = [starts on next line...]\n' + str(date_string_raw) + '\n' + 'x'*80 + '\n'
    srchpatrn = r"(from:\t )(([A-Za-z\. ]+?)(?: ))?([A-Za-z.\-_0-9]+@[A-Za-z.\-_0-9].+?\.(?:com|org|net))"        

    matchObj = re.search(srchpatrn, date_string_raw)
    if matchObj:
        print 'Line 35:  matchObj found\n str(match_obj.group(0)) = ' +  str(match_obj.group(0))
        sender_info = str(match_obj.group(0))
    return sender_info


if __name__ == '__main__': 
    harvey = fn_get_srctxt_hg_datestring_rawdata_from_clipbd()
    print harvey
    date_string_raw = harvey
    print '*****'*50
    print '\n\n'
    print fn_cull_sender_info(date_string_raw)

And the following (which is text produced by another function [not shown here]) is the text that I have in the Windows Clipboard when I run the python code above:

sender_display_name = matchObj.search(date_string_raw).group(2)#.strip() 
sender_eml =      matchObj.search(date_string_raw).group(4)

I’ve spent days trying to find out what I’m doing wrong.
I want to capture regular expression groups 3 and 4 into string variables, e.g.

But since I can’t get the matchObj to return as True, I can’t get there.

  • 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-28T03:57:50+00:00Added an answer on May 28, 2026 at 3:57 am

    You’ve previously defined matchObj, not match_obj.

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

Sidebar

Related Questions

I know that there is already a question (actually some more) about this, but
I know there is this question that is very similar, but I wanted to
I'm afraid that I already know the answer to my question, but I'll ask
I know this question has been asked several times an I spent all day
I apologize in advance because this is somehow a silly question, but I just
I asked a similar question last week but did not get an answer that
I know this sort of question has been banded about before but I've not
I know there are several questions similar, but I can't find one that answers
I have a question that I cant seem to find an answer on. This
This is something I know can be done somehow , because I've done it

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.