Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re:^3: Regex confusion

by flounder99 (Friar)
on Aug 07, 2002 at 17:22 UTC ( #188395=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Regex confusion
in thread Regex confusion

OK, to match those possible characters (and only those) try something like
m/((?:\w|\\\&|\-)*)\.((?:\w|\\\&|\-)*)/
the \w takes care of letters, numbers and _. I always escape the - out of habit but is unnecessary. The /i is redundant since the \w is case insensitive.
Personally I would do a nongreedy match. It will match other characters but it probably won't matter. Something like:
m/(.*?)\.(.*)/
update -- of course a simple split would do the trick.
my ($client, $project, $subproject) = split /\./, $x;

--

flounder

Replies are listed 'Best First'.
Re: Re:^3: Regex confusion
by neilwatson (Priest) on Aug 07, 2002 at 18:08 UTC
    update -- of course a simple split would do the trick.

    Neil bangs his head vigourously against his desk. Of course! Why the hell didn't I think of that before?

    Thank you all for your input.

    Neil Watson
    watson-wilson.ca

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2023-09-23 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?