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

  • SEARCH
  • Home
  • 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 7189785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:22:33+00:00 2026-05-28T19:22:33+00:00

I have a text area which is filled from database. In that textarea comma’s

  • 0

I have a text area which is filled from database. In that textarea comma’s are replaced by white space using this.

 document.getElementById('<%=fnl000Db000MESSAGE.ClientId %>').value=document.getElementById('<%=fnl000Db000MESSAGE.ClientId %>').value.replace(/,/g,'\s');

Now I want to insert a new a new line after first two words like this..
eg.. hello admin ‘\n’ welcome

how can i get this using javascript. Do i need to use Regex or any other way.

I want an output like
Hello Admin
Process are running…

  • 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-05-28T19:22:34+00:00Added an answer on May 28, 2026 at 7:22 pm

    This isn’t all fancy like a regex, but I find it easier to read =).

    http://jsfiddle.net/Pfx3P/

    var foo = 'Hello Admin Process are running....';
    var secondSpaceIndex = foo.indexOf(' ', foo.indexOf(' ') + 1);
    var foo2 = foo.substr(0,secondSpaceIndex) + '\n' + foo.substr(secondSpaceIndex + 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area into which users enter a lot of text that
Possible Duplicate: Capture newline from a textarea input I have a text area where
I have a textarea which is a tinymce editor. This text area contains html.
I have a text area which I need to prevent from having javascript entered.
I have a text area in my form which accepts all possible characters from
I have a text area which gets filled in various ways including paste, keyboard
I have a page which has a rectangular area with text and icons in
I have a form with a textarea. Users enter a block of text which
i have one text area <textarea name=message id=message class=text_field style=height:200px; width:500px></textarea> if i type
I have a text area in which users can type source code (html/css/js). I

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.