S
S
Sergey2021-06-15 16:57:53
JavaScript
Sergey, 2021-06-15 16:57:53

How to write a regular expression for the place of birth field?

Good afternoon, please tell me there are such two lines of regular expressions in JavaScript

const str = /([\ \-\–\'\`\’\.\,])\1/;
const str2 = /(?=[\ \-\–\'\`\’\.\,=]{2})/; но они не работают так как надо
to validate the "Place of Birth" input in the form. 60c8af6086b6e879107175.png
There is a clear requirement for the validation of this field only - combinations of text with the symbols "." "space", "," "space" and "." "," "space"; there should be only such a combination as in this picture - 60c8b79f7b5cf705203385.png
Help me write the correct regular expression

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2021-06-15
@rozhnev

Programmers misconceptions about addresses

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question