Jump to content

Clear entire line where string is found JAVASCRIPT


Recommended Posts

I need to clear the whole line where a certain string is found, until the carriage return.

var LineStr = "* What a beautiful day\n";
var ResultingEmptyLine = preg_replace('/* What[\s\S]+?day\n', '', LineStr);

The code below does not work. Any suggestion?

If there is no way of doing this, how could I then delete all characters present between "* What" and the NEXT "*" (assuming that there are many statements in the textbox area as a bulletpoint list with "*").

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...