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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:04:42+00:00 2026-06-08T08:04:42+00:00

Do these two substitutions always yield the same results? $data =~ s/\p{Space}//g; $data =~

  • 0

Do these two substitutions always yield the same results?

$data =~ s/\p{Space}//g;

$data =~ s/[\h\v]//g;
  • 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-08T08:04:44+00:00Added an answer on June 8, 2026 at 8:04 am

    Yes.

    $ diff -U0 \
          <( unichars -au '\p{Space}' ) \
          <( unichars -au '[\h\v]'    ) \
       && echo No differences
    No differences
    

    Contrast with

    $ diff -U0 \
          <( unichars -au '\p{Space}' ) \
          <( unichars -au '\s'        ) \
       && echo No differences
    --- /dev/fd/63  2012-07-20 11:28:33.356934588 -0400
    +++ /dev/fd/62  2012-07-20 11:28:33.356934588 -0400
    @@ -3 +2,0 @@
    - ---- U+0000B LINE TABULATION
    

    \s might start including U+000B soon, though.

    unichars is installed by Unicode::Tussle.


    Note: Without /u or use 5.012;, \s sometimes doesn’t match NBSP.


    I just found a bug in Perl (5.16.0). Reporting it immediately.

    $ perl -le'print "\xA0" =~ /\p{Space}/ ?1:0'
    1
    
    $ perl -le'print "\xA0" =~ /\s/ ?1:0'
    0
    
    $ perl -le'print "\xA0" =~ /\s/u ?1:0'
    1
                                             __
    $ perl -le'print "\xA0" =~ /\h/ ?1:0'      \
    1                                           \
                                                 > huh??
    $ perl -le'print "\xA0" =~ /[\h]/ ?1:0'     /
    0                                        __/
    
    $ perl -le'print "\xA0" =~ /[\h]/u ?1:0'
    1
    

    So that means, no, \p{Space} and [\h\v] are only equivalent if /u or use 5.012; is used.

    Ticket #114220

    Status:

    • /\h/ is equivalent to /[\h]/ in 5.10, 5.12, 5.14 and 5.18
    • /\h/ is not equivalent to /[\h]/ in 5.16.0
    • Don’t know about 5.16.1
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

These two methods appear to behave the same to me public IEnumerable<string> GetNothing() {
These two querys gives me the exact same result: select * from topics where
So these two methods have the same signature but different constraints public static void
Do these two statements pass the same type of argument (a Hash) to the
Consider these two classes mapped to the same table. One is readonly via mutable=false.
Why these two pieces of codes, running on same conditions, does not have difference
Are these two blocks exactly the same? Does one have any advantage over the
These two files are mostly seen in open source projects. What are they for,
These two queries work: SELECT u.id, u.email, COUNT(*) as Current FROM users u, rounds
Given these two queries: Select t1.id, t2.companyName from table1 t1 INNER JOIN table2 t2

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.