Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Regex Optimization Question

by graff (Chancellor)
on Mar 24, 2006 at 02:38 UTC ( [id://538931]=note: print w/replies, xml ) Need Help??


in reply to Regex Optimization Question

If the quotation marks are really reliable, you could do it like this:
my @strings = ( qq/Win32_Account.Domain="ADDomain",Name="aduser1"/, qq/Win32_Account.Domain="foobar",Name=""/, qq/Win32_Account.Domain="ADDomain",Name="aduser2"/, ); for ( @strings ) { my $user = join( "\\", (split /"/)[1,3] ); $user = "Account Deleted" unless ( $user =~ /\S+\\\S+/ ); print "$user\n"; }

Replies are listed 'Best First'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-03-28 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found