M
M
MaMkO2020-03-02 21:25:19
JavaScript
MaMkO, 2020-03-02 21:25:19

How to correctly compose a JS regular expression?

Hello, how can I use .replace to replace the space character with "|", but only if this space is followed by some other character?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-03-02
@MaMkO

str.replace(/ (?=[^ ])/g, '|');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question