RegEx string for three letters and two numbers with pre- and post-spaces

Two quick questions:

  • What will be the RegEx string for three letters and two numbers with a space before and after (ie "LET 12")?
  • Could you find out any good RegEx resources / tools?
+5
source share
6 answers

For a good resource, try this website and the RegexBuddy program . You can even determine the answer to your question using these sites.

To start with you, you want something like this:

/^[a-zA-Z]{3}\s+[0-9]{2}$/

. , , , , . . :

  • ""? A-Z ? ?
  • ""? 0-9 ? ? ? ?
  • ? ? ?
  • ? ?
  • ...

. , , .

, . ?

:

  • ? , , ?
  • ?

:

/^\s+[a-zA-Z]{3}\s+[0-9]{2}\s+$/
+9

/[a-z]{3} [0-9]{2}/i 3 , , 2 . [a-z] , a z, {3} , 3 . (, \s, "", ). i , , case-insenstive.

, , anchor ^ $:

/^[a-z]{3} [0-9]{2}$/i

:

+2

^([A-Za-z]{3}) ([0-9]{2})$, /, . .

http://gskinner.com/RegExr/ - .

+1

\w{3}\s{1}\d{2} .

EDIT: [a-zA-Z]{3}\s{1}\d{2} - \w .

0

, , , RegEx - , -. .

^[a-zA-Z]{3}\s*\d{2}$

I used [a-zA-Z]instead \wbecause \wsometimes it includes underscores.

\s* - allow zero or more spaces.

I try to use character classes wherever possible, so I went with \d.

0
source

try this regularexpression

[^"\r\n]{3,}
0
source

All Articles