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 9198587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:19:13+00:00 2026-06-17T22:19:13+00:00

I wrote a script for some text manipulation, and want to add a function

  • 0

I wrote a script for some text manipulation, and want to add a function so that the first line of my input string is removed if it starts with the symbol ‘>’. I tried to find a solution for hours now, but I cannot get it to work: Somehow the first line is not removed properly.

My input text should be processed as it is if it looks like this:
“HABHHIKKLLMMNMNIL”
and the first line should be removed if it looks like this:
“

>some text
HABHHIKKLLMMNMNIL

“

My current solution would look like this:

// remove first line if starts with '>'


if (sequence_str.substring(0) === '>'){
    // break the textblock into an array of lines
    var lines = sequence_str.split('\n');
    // remove one line, starting at the first position
    lines.splice(0,1);
    // join the array back into a single string
    var sequence_str = lines.join('\n');
}

sequence_str = sequence_str.replace(/(\r\n|\n|\r)/gm,""); //remove linebreaks

I would appreciate any ideas, and I hope some could help me to figure out where the problem is.

Thanks!

  • 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-17T22:19:15+00:00Added an answer on June 17, 2026 at 10:19 pm

    Why not just this?

    sequence_str = sequence_str.replace(/^>.*/,'');
    

    This will remove the first line if it starts with >. It will leave an empty line (the newline character is unaffected), but since you’re later stripping all line-breaks, it doesn’t matter.

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

Sidebar

Related Questions

I wrote a Python script that does some task to generate, and then keep
I wrote an init script to execute last that will start some pythjon script.
I wrote a Perl script that it makes some SQL queries in a table
I wrote a PHP-CLI script that mixes two audio (.WAV PCM) files (with some
I wrote a little script that connectts to an URL, posts some xml data
I wrote a script to parse an input text file and output three new
I'm having some trouble whenever I want to add some text to my div
I wrote a little script that check something, and i want a command to
I wrote some script in a site. The script makes a new spreadsheet and
I have wrote a script to do some backup. There is a if block

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.