-2

I just wanted to make the regular expression to check the given value

For example I need to check the below value in regular expression ,integer value should not start with zero and it could be any value but only it should not be start with zero, e.g.:

m=text 123034

I wanted to make sure that after space integer value should not start with a zero.

Dominique
  • 16,450
  • 15
  • 56
  • 112

1 Answers1

-1

I have put a similar string "m=text 12345" in a file (file.txt), and launched following command:

grep "^[a-z]=[a-zA-Z]* [1-9][0-9]*" file.txt

Explanation:

  • ^ : beginning of line
  • [a-z] : any letter from a to z
  • [a-zA-Z]* : any letter, small of capital, for a number of times (can be 0)
  • [1-9] : the number should not start with a zero
  • [0-9]* : the rest of the number can contain zeroes
Dominique
  • 16,450
  • 15
  • 56
  • 112