fbicknel has asked for the wisdom of the Perl Monks concerning the following question:
Now say you want to parse that. I came up with this regex that seems to do it, at least for some of the simple tests below.['] [userid] [/ [password]] [@net_service_name] [']
Samples.my ($userid, $password, $netServiceName) = /'?([^@\/']+)?(\/[^@\/']*)? +(@[^@\/']+)?'?/;
>>SYS/change_on_install@prod1<< <SYS> </change_on_install> <@prod1> >>rman/rman@rcat<< <rman> </rman> <@rcat> >>SYS<< <SYS> <> <> >>/<< <> </> <> >>/fooey<< <> </fooey> <> >>/fooey@foobar<< <> </fooey> <@foobar> >>SYS@foobar<< <SYS> <> <@foobar> >>'simple/fooey@foobar'<< <simple> </fooey> <@foobar>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing an Oracle connect string
by a (Friar) on Mar 05, 2011 at 00:01 UTC | |
by fbicknel (Beadle) on Mar 07, 2011 at 19:44 UTC |