Solved

Perl Reguler expression meaning

Posted on 2007-11-16
8
233 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 500 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
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…

626 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