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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:28:04+00:00 2026-05-15T06:28:04+00:00

I have this line /Od /D WIN32 /D _DEBUG /FD /EHa /MDd /FoDebug /FdDebug\vc80.pdb

  • 0

I have this line

/Od /D "WIN32" /D "_DEBUG" /FD /EHa /MDd /Fo"Debug" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr /TP .\main.cpp"

And I want to extract the .\main.cpp. I thought the following would do the trick:

if($string =~ /.*\s+(.*)$/i) {
 print "matched ",$1,"\n";
}

because this same regex works in Ruby, and extracts the string I required. How can I get it working?

EDIT: here’s how I setup my string:

for(find_indexes(\@lines,"/MDd")) {
    my $actual_line = $lines[$_];
    $actual_line    = modify($actual_line,$additional_defs);
}

find_indexes returns the indexes of lines matching any of the parameter following the array ref. The modify sub will return a modified version of the string sent to it, containing some additional defines.

EDIT2: here’s the modify sub:

sub modify {
    my $string      = shift;
    chomp($string);
    my @defines     = @_;
    if($string =~ /.*\s+(\".*?)$/) {
        my $match = $1;
        print "match is $match";
        my $string_copy = $string;
        print "|$string_copy|\n";
    }
}

The sub isn’t complete, as I wasn’t able to get it to work the way it should. I added an extra quote in the capturing group to force it to match the name. Something strange’s happening though, I would expect the print of the $string_copy to print the original string surrounded in |. However, I only get the leading pipe, not the ending one. I thought maybe Perl is interpreting the interpolated variable wrong, and I tried to do it like this:

print "|",$string_copy,"|\n";

but I still only get a leading pipe. This leads me to think something may indeed be wrong with the string. I can’t think of anything else.

  • 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-15T06:28:05+00:00Added an answer on May 15, 2026 at 6:28 am
    my $string = '/Od /D "WIN32" /D "_DEBUG" /FD /EHa /MDd /Fo"Debug" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr /TP .\main.cpp"';
    if($string =~ /.*\s+(.*)$/i) {
        print "matched ",$1,"\n";
    }
    

    This works for me and prints matched .\main.cpp".

    Please show how do you set up $string. It’s possible that you somehow messed up with quotes or something.

    EDIT: Is it possible that you have \x0d symbol at the end of your string? You would not notice it in log when you print your string and chomp won’t remove it:

    my $string = '/Od /D "WIN32" /D "_DEBUG" /FD /EHa /MDd /Fo"Debug" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr /TP .\main.cpp"' . "\x0d";
    chomp $string;
    if($string =~ /.*\s+(.*)$/i) {
        print "matched ",$1,"\n";
    }
    

    This prints matched for me, without capturing the file name. Maybe that’s your case?

    C:\>perl --version
    
    This is perl, v5.10.1 built for MSWin32-x64-multi-thread
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this line in the declarations section: Private filePath As String And something
I have this line in my program : InputStream Resource_InputStream=this.getClass().getClassLoader().getResourceAsStream(Resource_Name); But how can I
I have this line below that shows a link to go the next page
I have this line of code: this.Path = pathLookUpLocation.GetValue(RegLookupKey, null).ToString(); When I run static
I have this line of code: System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(shinfo.hIcon); A few lines later,
Say I have this line of code in the view. <?php echo CHtml::activeTextField($model,'start_time'); ?>
If I have this line and I'm wondering if there's better way to do
For example we have this line chart at Google Code API there is a
At the beginning of a makefile I have this line : PATH := $(PATH):/other/dir
OK. For example I have this line in my txt file: 1|1,12;7,19;6,4;8,19;2,2 As you

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.