Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Perl Reguler expression meaning

Posted on 2007-11-16
8
Medium Priority
?
240 Views
Last Modified: 2013-12-04
Hello there,
could you please Help me,
My perl scrpt is
#if (($infoline =~ /$costCenter/) && !($infoline =~ /_/))
                  if ($infoline =~ /[^_]$costCenter/)
                  {
                        $debugString = $infoline;
                        myDebug();
                        $receivedLoginPath = $infoline;
                  }

            }

What the regular expression tell in tthis matter?

Because I need to get in the log file is below info,

CTSA1_state=Name of the state.
CTSA1_city=_Name of the city.
CTSA1_postalCode=5 numbers
CTSA1_company=Name of the Company
CTSA1_sAMAccountName=Some specific account name
CTSA1_scriptPath=\alluser.bat (Specially here instead of just /alluser.bat I should have got Company name/Department/COst center number/alluser.bat)

how I shoul dget it?
Is there anything wrong in regular expression or what?
Thank you,

0
Comment
Question by:rachelee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 20297130
it tells whether $infoline contains a character other than _ followed by whatever is matched by $costCenter

If there is something wrong in $costCenter, then there is something wrong in the regular expression
0
 

Author Comment

by:rachelee
ID: 20297181
Mr OZO,
Thnx a lot for a prompt reply ,

would u please give more explaination about this
>>it tells whether $infoline contains a character other than _ followed by whatever is matched by $costCenter

Because I am new bie ..Sorry to bother u.
0
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 20297209
for example, if $costCenter is X then $infoline =~ /[^_]$costCenter/   it true when $infoline contanins a character other than _ followed by X

if $costCenter is )(**  then /[^_]$costCenter/ is an error
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 

Author Comment

by:rachelee
ID: 20297267
yep I could solve it dear ...
Thank you so much....

I appreaciate u for explaining it.
I just put a debug there for cost center and worked well...
0
 

Author Comment

by:rachelee
ID: 20297324
Would please so kind to suggest what all I can read to understand regarding Perl scripting and problems or tutorials regarding the same.

Thanking you,
0
 

Author Comment

by:rachelee
ID: 20297325
Please let m eknow if you can...but only online stuff I can not buy books I think.
0
 
LVL 84

Expert Comment

by:ozo
ID: 20297352
perldoc perlre
0
 

Author Comment

by:rachelee
ID: 20297359
thnx ,

have a nice day...byeeee
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Six Sigma Control Plans

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question