You're right: whitespace wasn't considered, I'll check to see if it's allowed. For now it's not. (edit: I checked.... it's allowed. I need to modify my r.e. to allow them then. Ick: quotes.)
As to the pointy stuff... it's just a way to show each of the fields one by one. Sorry for the confusion.
Ok, so I diddled a bit with this and came up with the following. It allows spaces in passwords (that's allowed, but not the other two fields.) It also allows spaces within the string, so long as they are next the delimiters, '/' and '@'. First, here's the code fragment:
10 $string =~ s/ *([@\/]) */$1/g;
11 my ($userid, $diag, $password, $netServiceName) = $string =~ /
+'?([^@\/']+)?(?:(\/)'?([^@\/']*)'?)?(@[^@\/']+)?'?/;
Since I added the ability to surround the password in 'quotes', it unfortunately removed that bit from the '/' discovery. So that's now captured in $diag.
Also (line 10) removes any optional spaces near the delimiters,
@\/
.
This seems to parse ok in my test program:
SYS / foo_pw @ stuff
SYS / ' foo_pw1' @ stuff
SYS /' foo_pw2' @ stuff
SYS / foo sp ace @ stuff
SYS/change_on_install@prod1
LAST
rman/rman@rcat
SYS
/
/fooey
/fooey@foobar
SYS@foobar
'simple/fooey@foobar'
Parses as:
< SYS> < /foo_pw> [ @stuff]
< SYS> < / foo_pw1> [ @stuff]
< SYS> < / foo_pw2> [ @stuff]
< SYS> < /foo sp ace> [ @stuff]
< SYS> </change_on_i> [ @prod1]
< LAST> < > [ ]
< rman> < /rman> [ @rcat]
< SYS> < > [ ]
< > < /> [ ]
< > < /fooey> [ ]
< > < /fooey> [ @foobar]
< SYS> < > [ @foobar]
< simple> < /fooey> [ @foobar]
(Note that my test program truncates some longer passwords in the printout.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.