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

242
Views
Cómo convertir parte de una cadena que incluye guiones bajos a paréntesis en logstash con gsub

Quiero convertir, por ejemplo, Hello_1_.Bye to Hello[1].Bye Tenga en cuenta que [1], es decir, entre paréntesis contiene solo dígitos

Empecé con algo como esto que no funcionó..

 filter { mutate { gsub => ["String", "*_\D_.*", "*[\D].*"] //Note that String here could be Hello_1_.Bye, Hello_2_.Bye etc. } }

pero obteniendo este error

 :exception=>#<RegexpError: target of repeat operator is not specified: /*_\D_*/>

Aprecio tu ayuda

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Sugiero usar esta versión:

 filter { mutate { gsub => ["Hello_1_.Bye", "([^_]+)_(\d+)_(\.\w+)", "\1[\2]\3"] } }

Aquí hay una demostración de expresiones regulares que muestra que el reemplazo está funcionando.

over 4 years ago · Santiago Trujillo 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!