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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:18:42+00:00 2026-06-12T23:18:42+00:00

problematic code: out, err = shellcmd.run_get_out(shell_cmd, login_shell=True) p = re.compile(‘^’ + module + ‘/(.*)$’)

  • 0

problematic code:

out, err = shellcmd.run_get_out(shell_cmd, login_shell=True)
p = re.compile('^' + module + '/(.*)$')
m = p.match(out)
if m:
    return m.group(1)
return None

It get the output from some shell command and do a regular expression match. For example: out is ‘rvct/4.1_0894\n’ and module is ‘rvct’, it returns ‘4.1_0894’
But on some system, the shell command output starts with a new line, the out will be ‘\nrvct/4.1_0894\n’, I have to make this change

p = re.compile('^\n' + module + '/(.*)$')

to make it work

Can I have a regex working on both situations? I have tried

p = re.compile('^' + module + '/(.*)$', re.MULTILINE)

It seems not working.

  • 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-12T23:18:43+00:00Added an answer on June 12, 2026 at 11:18 pm

    You can strip newlines from the output first, using out.strip().

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

Sidebar

Related Questions

My problematic code: testMYSQL=`mysql -u $mysqlUser -p$mysqlPass -h $mysqlHost --skip-column-names --batch -D $mysqlDB -e
The program Reads out a textfile and emails it's contents The original code (with
This question is continuation of my question . Here is problematic code. a.h: #include
The code below demonstrates the problematic joda-time implementation of week calculation. This behavior is
Our development uses lots of open-source code and I'm trying to figure out what
This is the problematic code: glColor3f(1,1,1); for(int x=0;x<125;x++){ for(int y=0;y<10;y++){ int p = levelArray[x][y];
Situation: I often run into this problematic and never know how to solve it.
This has been a rather problematic issue on numerous occasions. We have alot of
I read that self closing tags were problematic for some browsers such as IE7
We have just completed implementing a successful but problematic project. We want to get

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.