Stored in my variable description
is the following text:
`This is a code update`
Official Name: 2011 New York City Electrical Code
Code Tile Name:
Reference: https://www.nyc.gov/site/buildings/codes/electrical-code.page
Citation: §27-3024
Doc Title: Local Law 39-2011, Local Law 99-2013, Local Law 39-2015
Source Doc: https://www.nyc.gov/assets/buildings/pdf/ll39of2011_electrical_code.pdf
Drive: https://drive.google.com/file/d/19Q0_G3VITpx0iCULtANMHqydAv0ZmvcF/view?usp=share_link
Effective Date: November 19, 2013
**SCTOMJ**
I am looking to extract the data associated with the phrase
Official Name', specifically '2011 New York City Electrical Code
. To do this, I initially used the code snippet below:
var official_name = description.search("Official Name:");
if(official_name != -1){
official_name = description.substring(official_name + 14, description.indexOf("Code Tile Name:")).trim();
}
The issue with the current code is that it relies on the fixed location of the phrase "Code Tile Name:", which is not ideal as the structure of the information may vary. I am seeking a solution that is not dependent on specific sequence.
Is there a method to locate the first newline character after a given position?
Thank you!