javascript - Regex - match a certain number of numeric when followed by letter -


I want to match a string where it is numbered 1-4, followed by a special letter.

For example, if my string

'The hardness of this rubber is 90A, hardness for another 120A'

I want to catch the value '90A' and '120A'

I tried ^ [0- 9] {0,4} [a] $ and ^ ([0- 9] {0,4}) [g] $

bonus points if you can match it with the space after numbers. For example,

'rubber number was 98a, the number of rubber 2 was 89' '

will match

'98 A '

and

'89 a'

no problem:

  \ b \ d {1,4} * a \ b    Explanation:   
  \ b # start the number (or if you are not on JavaScript then use (? & Lt;! \ D) D {1,4} # match 1-4 points [] * # match the # optional location (fairs) ## "A" \ b # match match match Please make sure that any letters / digits thus    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -