-1

They send me a text file that starts with unnecessary information and then what is needed goes further. How to remove the beginning to a specific symbol.

Example: line = 'lots of text {text needed}';

It is necessary to delete everything before the symbol {. I tried the regular expression option below:

let str = /^[^{]+/.exec(line)[0];

but it returns the beginning of the text to the symbol { I need to do the opposite.

Dharman
  • 30,962
  • 25
  • 85
  • 135
ivkor
  • 13
  • 1

1 Answers1

-1

This is how you can do with JavaScript.

var str = 'lots of text {text needed}';
str = str.substring(str.indexOf("{") + 1);
console.log(str);
Pushprajsinh Chudasama
  • 7,772
  • 4
  • 20
  • 43