CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [KevinR] General Q about regex matches VI vs. Perl: Edit Log



diemaker
New User

Sep 28, 2003, 9:00 PM


Views: 5901
Re: [KevinR] General Q about regex matches VI vs. Perl

Thanks for the reply KevinR. Let me clarify a little. Take this sample file for example:

abc
def
ghi

A search in VI for :/\w\n will find the last letter (c, f, and i) in each line and the \n at the end of each line.

But in Perl, a match for \n works, but I get no matches with a search for \w\n only a match when using \s\n.

sample code to count matches:

my $count=0;
while ($stext =~ /\w\n/g) {
$count++;
}

So why does VI match \w\n with no problem but Perl does not in the same file? The \w\n pattern is not hard to identify. What do people use to clearly see all visible and special characters in a file?


(This post was edited by diemaker on Sep 28, 2003, 9:06 PM)


Edit Log:
Post edited by diemaker (New User) on Sep 28, 2003, 9:05 PM
Post edited by diemaker (New User) on Sep 28, 2003, 9:06 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives