Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Operación analógica para el código de Python para el módulo RE de JavaScript

Aquí está el código:

 lines = re.split('\\s*\\n+\\s*', text) joint_stack = [] for line in lines: words = re.split('\\s+', line) instruction = words[0]

Mi código JS es:

 _parse_hierarchy(text) { var lines = text.split('\\s*\\n+\\s*'); console.log("Test _parse_hierarchy -> ", lines);

Obtuve una matriz pero obtuve el texto completo en un elemento. La longitud de mi matriz es 1.

Parece que necesito expresiones regulares para dividir por línea...

También pruebo var lines = text.match('\\s*\\n+\\s*'); sin exito

Cualquier sugerencia ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Forma correcta para el formato js: \\ => \ y sin ' o " .

 var lines = text.split(/\s*\n+\s*/); console.log("Test lines -> ", lines); for (var key in lines) { var line = lines[key]; console.log("Test _parse_hierarchy FIRST WORD -> ", line); var words = line.split(/\s+/); // var firstword = words[0];
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!