I try to have the user enter exactly 4 characters without spaces ... this is what I have:
.[^\s]{4}
but everything I entered says it doesn't match the regex ...
Where am I going wrong?
Why is there another one ahead .? This will match a single character before your βfour spacesβ are counted.
.
You might also want to associate it with the beginning and end of a line, so:
^[^\s]{4}$
, , \S, \S, . , :
\S
^[\S]{4}$
:
^ -
[/S] - "S"
{4} - 4
$-
\S{4}
4 . # regex, Expresso.
Java:
[^\s]{4,4}
- /^ [^\s] {4} $/
txt2re.com .
Source: https://habr.com/ru/post/1714900/More articles:Is multiple standalone IE a Microsoft license violation? - internet-explorerTimezone synchronization between Windows and .NET - timezoneThere is a query with LINQ - c #Why is this convention for event handler suffixes using a "handler"? Why not attach them to the pen? - naming-conventionsDataGridView performance - does it depend on the video card? - windowscudaMemcpyToSymbol does not copy data - gpuHow to get the current view size for an image in Delphi 2009 - delphiASP.NET MVC - an alternative to using a session - asp.net-mvcIPhone serialization issue - serializationWhy can't I open a file using impersonation on a remote machine? - securityAll Articles