Solved

what is the use

Posted on 2013-12-26
4
191 Views
Last Modified: 2013-12-26
Dear all,
can anyone please tell me what this do:
var items = DataItems.replace("(?m)^[ \t]*\r?\n", "");

Open in new window

0
Comment
Question by:ethar1
  • 2
4 Comments
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 450 total points
ID: 39740224
It replaces any number ( * )--including zero--of spaces and tabs ( [ \t] ) found just before a newline character ( \n ) with an empty string ( "" ). The newline may be optionally ( ? ) preceded by a carriage return ( \r ).

This is what is known as a regular expression. The replace method accepts such as a parameter. You can read more at www.regular-expressions.info.
0
 
LVL 7

Assisted Solution

by:dimmergeek
dimmergeek earned 50 total points
ID: 39740233
I'm  not too great with regexes, but I believe this will replace all tabs and newlines with and empty character string ("").  The (?m) tells the regex to match at all line breaks
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 450 total points
ID: 39740250
but I believe this will replace all tabs and newlines
It will match all tabs (and spaces) that occur immediately before a newline, not simply all tabs (and spaces). To say that all newlines will be replaced is accurate.
0
 

Author Comment

by:ethar1
ID: 39740366
dear all,
could you please continue answer the question :
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28325842.html
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question