G
G
Galdar Turin2020-06-18 14:09:09
JavaScript
Galdar Turin, 2020-06-18 14:09:09

How to make a regular?

It is necessary to remove these characters #&|?:"" from the string . I do not understand how to make it so that characters are deleted individually from different places in the string. At me it turns out to delete them only by a line.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2020-06-18
@Galdar

str.replace(/[#&|?:«»]/g, '')

X
xenonhammer, 2020-06-18
@xenonhammer

in order to have an enumeration, for example from and to, square brackets are used. by analogy /[0-9]/ will mean that each digit from 0 to 9 falls into the sample. The same with letters /[0-9a-z]/. add "i" to this regular expression and get a case-insensitive sample - /[0-9a-z]/i

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question