R
R
Rishat Sultanov2017-08-24 17:42:43
JavaScript
Rishat Sultanov, 2017-08-24 17:42:43

How to process a string with a regular expression?

Good evening!
I have such a line.
22\r\n1023\r\n'
In this line where now the number 22 can be numbers from 0 to 50.
Where the number 1023 can be numbers from 0 to
1023
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita, 2017-08-24
@rishatss

/(^\d{1,2})\D+(\d{1,4})/

D
Dark_Scorpion, 2017-08-26
@Dark_Scorpion

If the string is of indefinite length (and not 2 numbers), then such a regular expression in js
/(\d{1,2})\D+/g

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question