why [^\/] didn't work --- How to march non-forward slash? 
Author Message
 why [^\/] didn't work --- How to march non-forward slash?


Quote:
> I am trying to march "http:/blaaa" instead of "http://blaaa"

> and I use the following regular expression:

>     /"http:\/[^\/"]+"/

That expression works for me. See attached test script.

But maybe, just maybe, you want to use this instead:

     /http:\/[^\/"]+/

Hope this helps!

-- Tom Phoenix             http://www.*-*-*.com/ ~rootbeer/            


#!/usr/bin/perl

# Matching a forward slash

$foo = '"http:/blaaa"';  # Want to match this
$bar = '"http://blaaa"'; # but not this

$foomatch = $foo =~ /"http:\/[^\/"]+"/ ? "does" : "does not";
$barmatch = $bar =~ /"http:\/[^\/"]+"/ ? "does" : "does not";

print "$foo $foomatch match\n";
print "$bar $barmatch match\n";

__END__



Mon, 15 Jun 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. why [^\/] didn't work --- How to march non-forward slash?

2. Changing back slashes to forward slashes

3. DBIx::Password/Bundle::Slash didn't set the virutal user

4. Erroneous Forward Slash in HTML Code by CGI.pm

5. back vs. forward slash

6. Substituting backslash for 2 forward slashes

7. eh, why didn't I think of that :-)

8. my simple perl application didn't work

9. Term::ReadKey non-blocking non-working in RH8.0

10. SysV IPC under Linux 2.0, can't get non-blocking to work

11. 5th Annual Tcl/Tk Workshop '97 - Submission Deadline March 11, 1997

12. 5th Annual Tcl/Tk Workshop '97 - Submission Deadline March 11, 1997

 

 
Powered by phpBB® Forum Software