Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: regex

by Speedy (Monk)
on Jul 23, 2002 at 15:17 UTC ( [id://184444]=note: print w/replies, xml ) Need Help??

in reply to want regex to strip "(xxx)"

Rather than using a regex, if the pattern is always "some-stuff one-or-more-spaces some-more-stuff" you could use a substr - index combination, like:

$Path = substr($Path, 0, index($Path,' '));
where the index function returns the position of the first space and substr pulls out the part of the string to the left of that position. Looks more like Visual Basic than Perl, but in the spirit of "more than one way to do it" works for this pattern.

Speedy tries to live in the moment

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-05-30 07:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found