By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,364 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,364 IT Pros & Developers. It's quick & easy.

what does /^[^ ]/ mean in perl?

P: n/a
what does /^[^ ]/ mean in perl?
Nov 4 '10 #1
Share this Question
Share on Google+
1 Reply


Expert
P: 70
It is a regular expression which matches any non-space character at the beginning of a string.

perlre

YAPE::Regex::Explain

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3.  
  4. use YAPE::Regex::Explain;
  5. print YAPE::Regex::Explain->new(qr/^[^ ]/)->explain();
  6.  
  7. __END__
  8.  
  9. The regular expression:
  10.  
  11. (?-imsx:^[^ ])
  12.  
  13. matches as follows:
  14.  
  15. NODE                     EXPLANATION
  16. ----------------------------------------------------------------------
  17. (?-imsx:                 group, but do not capture (case-sensitive)
  18.                          (with ^ and $ matching normally) (with . not
  19.                          matching \n) (matching whitespace and #
  20.                          normally):
  21. ----------------------------------------------------------------------
  22.   ^                        the beginning of the string
  23. ----------------------------------------------------------------------
  24.   [^ ]                     any character except: ' '
  25. ----------------------------------------------------------------------
  26. )                        end of grouping
  27. ----------------------------------------------------------------------
Nov 4 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.