Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

re: why extra slash in regex? (was "Warning our Fellow Monks")

by t'mo (Pilgrim)
on Mar 16, 2001 at 23:07 UTC ( #64978=note: print w/replies, xml ) Need Help??

in reply to RE: RE: Warning our Fellow Monks
in thread Warning our Fellow Monks

The line:

$siteinfo[1] =~ /^[^.]+/(\w+\.\w+)$/ or ...

in Ovid's example has me confused. The extra slash (/) in the middle is throwing me off. At first glance, it looks like he meant to use the s/// operator. At second glance, it becomes apparent that it's meant as a directory separator (to exclude things like "../../". However, doesn't placing a '/' in a regexp delimited by '/' characters require an escape character (\)?

(I must be getting a mild case of LTS)

Replies are listed 'Best First'.
(tye)Re: why extra slash in regex? (was "Warning our Fellow Monks")
by tye (Sage) on Mar 17, 2001 at 00:45 UTC

    Yes, you need to escape the / (with a \) or change the regex delimiter.

            - tye (but my friends call me "Tye")
Re^2: why extra slash in regex? (was "Warning our Fellow Monks")
by Anonymous Monk on Jul 25, 2005 at 14:35 UTC
    10 Print "I am not worthy" + CHR(10); 20 GOTO 10
    Would be interested to see if the panel thought there's mileage in suggesting that it's unlikely that the user should want to open *any* type of file - and hence we could either assume an extension (and add it on explicitly before passing the filename to the ope() ?) - or offer a list, which would map to extensions (not just add on the field value (which could be faked to blank or a pipe)) Also - could the script not be forceably chrooted ? JAPHN (JAPH Novice)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://64978]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2021-07-29 18:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found