Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7735387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:29:23+00:00 2026-06-01T07:29:23+00:00

I am trying to write a script to automate a rather long and painful

  • 0

I am trying to write a script to automate a rather long and painful process I am required to do at work.

Scenario:
In short, I am given a text document that has 4 lines of text and two line breaks, and this format repeats for 5 to 8 pages. I then have to extract 6 pieces of information from each “paragraph” and type them out into a table in another document.

Since the output I get is formatted (including the fields that I extract data from), I would like to be able to paste my text into a textbox, click convert, and have it return the results I need and list them in a table.

Where I need help/advise:
From my limited JavaScript knowledge, I am thinking that I need to set <p> tags around each 4-line “paragraph.” Then I should be able to write a script that would select the <p> tag, extract the data I need, write it to the table, and repeat the process for the next <p> tag.

I know there are online options that will do this for me (textfixer.com, for example), but my system is not connected to the internet, and for security reasons, it will never be. This means I can not use PHP (which I know better) or any other server-side processing. I am hoping this can be done through JavaScript, so I can process it through a browser. This is a Windows machine so if there is another way to do it, I am open to ideas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:29:24+00:00Added an answer on June 1, 2026 at 7:29 am

    You could split the document on a series of three line breaks (one to account for the end of line break, two for the empty lines), and then rejoin them with paragraph tags:

    // pull the document out
    var doc = $("#my-document").val();
    
    // split on double line breaks
    // note that we actually split on triple to account for the trailing
    // line break at the end of a paragraph
    var parts = doc.split("\n\n\n");
    
    // rejoin with paragraph tags
    doc = parts.join("</p><p>");
    
    // wrap the entire thing in open/close paragraphs
    doc = "<p>" + doc + "</p>";
    
    // and stick it in the output
    $("#output").html(doc);
    

    Example: http://jsfiddle.net/2uMaK/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a python script to automate the process of checking
I'm trying to write a script in jQuery that would iterate through each text
I am trying to write a script which will automate a copy/paste of employee
I'm trying to write a PowerShell script that will automate my IIS website deployments.
I'm trying to write a script to automate a repetitive task I currently do
I was trying to write a script that checks the second text field if
I am trying to write a script which reads a text file and saves
I'm trying to write a script that will create a user in MediaWiki, so
I'm trying to write a script that allows an admin of a photo uploading
I'm trying to write a script that will download files from an FTP server.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.