I
I
Ilya Kuznetsov2018-12-11 21:54:14
Regular Expressions
Ilya Kuznetsov, 2018-12-11 21:54:14

How to correctly make a regular expression that finds numbers and arithmetic symbols?

Tried to search in different directories, but without success. I would be grateful to those who know.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-12-20
@KuzyXD

It's not clear what exactly you need.
If individual characters, then [0-9\-+*/], if sequence (aka expression), then [0-9\-+*/]+(but here with great care, because there may be spaces, and where there are spaces, there may be several expressions).
Well, if you need to parse an expression, taking into account the syntax and the presence of errors, then you won’t get by with a regular expression, then you need to write a full-fledged parser.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question