R
R
Roman Rakzin2020-05-07 00:05:27
JavaScript
Roman Rakzin, 2020-05-07 00:05:27

How to find and remove a piece of text in javascript using a regular expression?

There is text like

текст начало........[caption bla bla bla]продолжение текста

How can I remove characters from this text starting with [captionand before the character ]?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-05-07
@TwoRS

str.replace(/\[caption .*?\]/g, '')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question