D
D
Dmitry2017-08-07 07:38:28
Ruby on Rails
Dmitry, 2017-08-07 07:38:28

How to bite a number out of a string using regular expressions?

It seems that everything should be simple, but I can’t understand ... there is a line of text in which there may be a number of digits in which more than 3 (bit depth is more than 3). It is necessary that there would be a check for the presence of such a number, and if it is, then it was assigned to a variable. For example:
200054325/par and some other text
, you need 200054325 in the variable
Help please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Novikov, 2017-08-07
@BOOMER_74

For example like this:
/^(\d{3,})/.match('200054325/par')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question