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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:37:48+00:00 2026-05-23T13:37:48+00:00

My perl is getting rusty. It only prints matched= but $1 is blank!?! EDIT

  • 0

My perl is getting rusty. It only prints “matched=” but $1 is blank!?!

EDIT 1: WHo the h#$! downvoted this? There are no wrong questions. If you dont like it, move on to next one!

$crazy="abcd\r\nallo\nXYZ\n\n\nQQQ";
if ($crazy =~ m/([.\n\r]+)/gsi) {
    print "matched=", $1, "\n";
} else {
    print "not matched!\n";
} 

EDIT 2: This is the code fragment with updated regex, works great!

$crazy="abcd\r\nallo\nXYZ\n\n\nQQQ";
if ($crazy =~ m/([\s\S]+)/gsi) {
    print "matched=", $1, "\n";
} else {
    print "not matched!\n";
} 

EDIT 3: Haha, i see perl police strikes yet again!!!

  • 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-23T13:37:48+00:00Added an answer on May 23, 2026 at 1:37 pm

    I don’t know if this is your exact problem, but inside square brackets, '.' is just looking for a period. I didn’t see a period in the input, so I wondered which you meant.

    Aside from the period, the rest of the character class is looking for consecutive whitespace. And as you didn’t use the multiline switch, you’ve got newlines being counted as whitespace (and any character), but no indication to scan beyond the first record separator. But because of the way that you print it out, it also gives some indication that you meant more than the literal period, as mentioned above.

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

Sidebar

Related Questions

All the Perl dependencies for it are met but I'm getting this error: Can't
I'm pretty new to NLP in general, but getting really good at Perl, and
I know that Strawberry Perl portable is out there for Perl 5.10.0, but so
Is there a more efficient way of getting the date in perl, and I
In Perl, what does this error mean? Unresolved symbol: Perl_Gthr_key_ptr I am getting this
I'm getting this warning: perl: warning: Please check that your locale settings: LANGUAGE =
Is there a pythonic way of getting only certain values from a list, similar
I started getting the hang of inheritance in Perl/Moose, but I'm starting to run
After uninstalling ActiveState I've been getting this weird error when trying to execute perl
fetchrow_hashref working fine, but when i use fetchrow_array getting following Error. #!/usr/bin/perl use warnings;

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.