How can I write a regular expression to match the lines following these rules?
I need to allow input as a 15 character string or 3 groups of 5 characters separated by a single space.
I implement this in JavaScript.
I won’t write all the regular expression for you, as this is homework, but here are some tips to help you:
[A-Z]
[0-9]
[A-Za-z0-9]
{n}
[A-Z]{3}
[%@#]
\$
$
^
\s
/[a-z]/i
i
:
/^[a-z][a-z0-9]{4} ?[a-z0-9]{5} ?[a-z0-9]{3}[0-9][!&@?]$/i
0-9 [0-9] \d, .. ^ $ , , , /i .
\d
/i
.
(, {N}) (, [a-zA-Z])
{N}
[a-zA-Z]
^[a-zA-Z][a-zA-Z0-9]{4} ?[a-zA-Z0-9]{5} ?[a-zA-Z0-9]{3}[\!\&\@\?]$
Source: https://habr.com/ru/post/1740595/More articles:The easiest free setup for C # development - c #A bitmap like a button? - actionscript-3How common is Eshell Emacs in cross-platform development? - shellHow to get context call object in Ruby? - ruby | fooobar.comIE7 and IE8: clear a float without adding empty elements - htmlIE7 float and clear the same element - cssHow to write a Lightroom plugin that sets the cropping of all selected images? - pluginsЕсть ли лучший способ поочередно отправлять несколько запросов AJAX? - javascriptBest cross-platform solution for a network server? - c ++Attaching events in JavaScript - javascriptAll Articles