Solved

Perl Reguler expression meaning

Posted on 2007-11-16
8
214 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
  • 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
 

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now