@
@
@Twitt2020-07-14 12:05:41
Regular Expressions
@Twitt, 2020-07-14 12:05:41

A regular that replaces forbidden characters?

octets 0-32 (0-20 hex), "\", """, "&", "<", ">", "[", "]", "^", "`", "{" , "|", "}", "~", octets 127-255 (7F-FF hex)

Is there a regular expression somewhere that replaces the above characters with "%" or "_"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2020-07-14
@Stalker_RED

Just escape the slash and the closing bracket, paste the rest
[\x0-\x20\\"&<>[\]^`{|}~\x7F-\xFF]+
https://regex101.com/r/iutiMk/3

which replaces
forced to dispel your misconception: regular expressions do not replace anything, they look for text. Replace functions like preg_replace()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question