M
M
mrim2018-02-23 16:53:55
JavaScript
mrim, 2018-02-23 16:53:55

Correct the regular expression, do you need to split the string into components?

There are lines of the form
8
8A
8Ak12
8Ak12str2 ​​I
use this but it only works for the line 8Ak12str2 ​​and then it selects "8Ak1str12", "8A", "k1", "str12" like this And with other examples the result is NULL The template of the line is 8A | k12 | page 2 First component, house number NUMBER one or more, LETTER (1-2) uppercase Second, body small letter k and numbers one or more Third structure in small letters pages and numbers one or more
match(/([0-9А-Я]*)(к[0-9]*)(стр[0-9]*)/)



Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick Sdk, 2018-02-23
@mrim

.match(/^\d+(?:[А-Я]+)?|к\d+|стр\d+/g)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question