
masaniparesh
Novice
Jul 27, 2009, 2:12 AM
Post #3 of 9
(11839 views)
|
Re: [ichi] Regular expression for tab separator
[In reply to]
|
Can't Post
|
|
Thanks Ichi, you are correct but before that I need to verify that the string is separated by /t or not. so for that I have to use regular expression. I am using below code but it returns only /proj in $1. my $line = "/proj/bar baz/with space dir /proj/bar baz"; my $my_re = '(?:(\/\w+))'; my $match = $my_re . '/t' . '{0,1}' . $my_re . '{0,1}'; if( $line =~ /$match/g ) { print "matched\n"; print "$1 <==> $2\n"; } else { print "not matched\n"; } Basically I want "/proj/bar baz/with space dir" in $1 and "/proj/bar baz" in $2. Thanks.
|