A
A
Asikov Artur2020-02-16 04:29:28
Regular Expressions
Asikov Artur, 2020-02-16 04:29:28

Why is parenthesis not escaped in regex?

There is a conditional chemical reaction

NH3 + K[Al(OH)4] + NaCl trying to find the substance K[Al(OH)4] in it

using a regular expression . /\bK\[Al\(OH\)4\]\b/iThe first bracket [ is escaped, but the second ] is not. How to fix it?
https://regex101.com/r/Fv6Qc9/2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valentyn, 2020-02-16
@Artur937

\bK\[Al\(OH\)4\](?=\s|\b)
https://regex101.com/r/Fv6Qc9/3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question