Solved

what is the use

Posted on 2013-12-26
4
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

739 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