0

I have below string output

Version: 9.1.2(Build:40)
Syntax version:4.00.10
Components:
Engine
Processors
Configuration file: C:/Informatica/9.1.0/DataTransformation/CMConfig.xml

Reports path: C:/Informatica/9.1.0/DataTransformation/CMReports
User logs path: C:/Informatica/9.1.0/DataTransformation/UserLogs

Package identifier: IF_Windows_OS32_x86_C32

License information:
License-file path: C:/Informatica/9.1.0/DataTransformation/CDELicense.cfg
Expiration date: unlimited
Maximum CPUs: 10
Maximum services: unlimited
Licensed components: HL7,BAI,EDI,SWIFT,EDF,HIPAA,ACORD,FIX,TeleKurs,NACHA,SAP Co
nversion Agent,Oracle BPEL,webMethods,BizTalk,IBM Message Broker,Excel,Pdf,Word,
Afp,Ppt

I'd like to fetch the value of Package identifier i.e., IF_Windows_OS32_x86_C32 using regex

1
  • What language are you going to use? Commented Aug 25, 2011 at 5:58

2 Answers 2

1

What about

Package identifier: (\S+)

?

Sign up to request clarification or add additional context in comments.

3 Comments

Joey: Package identifier: (\S+) selects the whole line, (?<=Package identifier:) (\S+) helped me Thanks. Also please tell me what is \S here?
\S matches a non-space character.
Abhishek: That's why there are parentheses around it, so you have that in a group. If you use the lookbehind you should include the space in it as well, so that you can use the whole match.
0

I will tell you, but only because you finally got the slashes’ slope correct. :)

 /Package identifier: *([^\n]*)/

Now the ID is in the first capture group. Omit the slashes if your regex engine doesn’t need delimiters like that.

2 Comments

It gives me Package identifier: IF_Windows_OS32_x86_C32 License information: License-file path: C:/Informatica/9.1.0/DataTransformation/
@Abhisek: Then you misrepresented the input file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.