troubleshooting Question

Need a Regular Expression.

Avatar of jdg3
jdg3 asked on
PerlAlgorithmsCOBOLRegular Expressions
6 Comments1 Solution941 ViewsLast Modified:
I have thousands of COBOL Copybooks where I need to make modifications to various number of PICS.  I am looking for a regular expression that will replace the following '9' to an 'X'  


From:

~PIC~9(N).

to

~PIC~X(N).


where the '~' is a VARIABLE number of spaces, and where 'N' is a VARIABLE number of digits. The period '.' at the end of the line is required on the line.  The parentheses '( )' are also required as part of the PIC line.

Finally,  I do not want to modify any PIC 9's that are COMP or COMP3.  For instance, the following is not a candidate for modification:

~PIC~9(7)~COMP3.

I am new to regular expressions, and do not know how to handle the parentheses and periods, inasmuch as they are actually part of the expression.  The type of regular expression can be Perl or Unix.

Thanks in advance.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros