Perl

Moderators: Jonathan
Number of threads: 1211
Number of posts: 3568

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Regexp with replace Posted by hfeldma1 on 2 Nov 2009 at 7:31 PM
I'm trying to do a regexp with a replace.

I have the following regexp:
^(?s)(?:.*)(?:Resistance Z/F A-Pair TG\s*)(\w+)(?:.*)

On the following source examples.

Resistance Z/F A-Pair TG OR Kohms
Resistance Z/F A-Pair TG 1234 Kohms

The regexp currently returns the "OR" in example 1 and 1234 in exmplae 2, exactly what I wanted, however I need to change/replace the OR in example 1 to a zero (0).




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.