[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2731
  • Last Modified:

Line break in Javascript rule

How can i get a line break to  occur before and after the "Company Name" field when it is used and no line break when it is not used in  the data file?

0
stephensdirect
Asked:
stephensdirect
1 Solution
 
hieloCommented:
What does your data file look like? Knowing if the data is formatted a specific way will help produce a solution. EX: If your data set is formatted as follows:
Name: John Doe
Company: Company Name
Phone: 999-999-9999
The following would work:
var companyRE = /Company:\s*(.+)/g;
var companyName="";
var result =getData().match(companyRE);
if(result!=null)
{
  for( var i=1;i<result.length;++i)
   companyName += "\n"+result[i]+"\n";
}
NOTE: getData() is a function that is meat to return that data from which you want to extract the company name
0
 
LeeKowalkowskiCommented:
What do you mean by "when it is used" ?

--
Lee
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now