Create a Perl program that is simply a loop over a set of “Regular Expressions” that perform the tasks described below, Computer Science Homework Help

Create a Perl program that is simply a loop over a set of “Regular Expressions” that perform the tasks described below, Computer Science Homework Help

Create a Perl program that is simply a loop over a set of “Regular Expressions” that perform the tasks described below. Use the attached file SampleConfig.txt as input.  

Note1: The Alice.txt file will only be used as part of an “In Lab” example/tutorial.

Note2: Though this is a bit assignment is a bit contrived, it does represent the types of actual text manipulations that might be performed over many large files.

Instructions:

Using the attached SampleConfig.txt file, provide a Perl regular expression for each of the following tasks:

  1. Remove any leading or trailing space from each line.
  2. Replace all of the occurrences of a full line of # characters (ignoring leading or training spaces and lines with just 1 #) with the following: # ———- #
  3. Change any URL ending in .htm to end with .html
  4. For any set of multiple words following an equal sign (=),  place what follows the equal sign in quotes.
    • eg: a = bcd efg  becomes a = “bcd efg
    • eg: a = bcd remains  a = bcd
  5. Add a semicolon (;) to the end of every line.
  6. Every line beginning with a comment marker (#) and containing additional text should have one (and only one) space following the comment marker.
    • For example:
        #     some text    becomes….
        # some text
         

  7. Replace any pattern in the form of [__UPPER-CASE CHARACTERS__] with (lower-case characters)
    • ie: Open square bracket + two underscores + upper-case text + two underscores + close square bracket
    • eg:[__SOMEDATA__] becomes [somedata]

  8. Follow every “config section” with a comment that indicates the current section count:
    • For example:
       [SVN]  # Section: 1
          [
      ……]  # Section: 2
         etc.


Submit:

  1. A file containing the Perl code to fulfill the above requirements

  2. A version of the SampleConfig.txt file incorporating all of the above changes.

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper