The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SED regular expressions noppeli Shell Programming and Scripting 3 09-10-2009 08:53 AM
regular expressions ramky79 UNIX for Advanced & Expert Users 1 05-26-2009 03:35 PM
Need help with Regular Expressions jidsh Shell Programming and Scripting 5 04-20-2009 05:00 PM
Awk regular expressions chella Shell Programming and Scripting 1 03-30-2009 07:32 AM
regular expressions whatever Shell Programming and Scripting 4 05-20-2007 05:30 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-02-2009
DavidHe DavidHe is offline
Registered User
  
 

Join Date: Oct 2009
Location: Sydney
Posts: 6
Red face Regular Expressions


Code:
#!/usr/bin/perl


$word = "one last challenge";


if ( $word  =~ /^(\w+).*\s(\w+)$/ )
{
	print "$1";
	print "\n";
	print "$2";

}

The output shows that "$1" is with result one and "$2" is with result challenge. I am confused about how this pattern match expression works step by step. I request u guys` explanation. Thank u very much.

Last edited by pludi; 11-02-2009 at 09:57 AM.. Reason: code tags, please...
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:21 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0