First steps in GREP: Finding a bigger number (Part 2)


Last time we used GREP to search for a number, but if the number was any larger than 9 it would be ignored, or rather found a single digit at a time, so this time we're going to extend this to find all numbers above zero

This is achieved by simply adding {1,} after the closing square bracket of our search query from last time, so that we have:

  ([0-9]{1,})


It tells the app (or program) that we want it to search for one or more of the thing asked for in the square brackets.

If we wrote {2,} this would be asking for two or more, but remember this doesn't mean necessarily 10 and above, because a numeral might be written 01. To search for 10 and above in the scenario where numerals might or might not be written with preceding zeros you'd need to write:

  ([0]{0,}[1-9][0-9]{1,})


which means zero or more zeroes followed by a number between 1 and 9, followed by any number of digits of the value 0 to 9.


Part 1 | Part 2

Comments