Notepad ++ find a number greater than a certain number

I have magazines with some random numbers.

What I want to do is find numbers greater than a certain number, for example: find the whole number> 1234567.

Does anyone help?

+4
source share
2 answers

Strange regex (not sure if it is really useful):

\d{8,}|123456[8-9]|12345[7-9]\d|1234[6-9]\d{2}|123[5-9]\d{3}|12[4-9]\d{4}|1[3-9]\d{5}|[2-9]\d{6}\b

It only works for a number 1234567, you need to change it for another number.

+2
source

You can use the Notepad ++ Python Script plugin. Not the best solution, but it works!

  • Install the Python Script plugin from the plugin manager or from the official site.
  • > Python Script > Script. (, find_numbers.py) .
  • > Python Script > > find_numbers.py, .
from re import finditer

number = 1234567

console.clear()
console.show()
content = editor.getText()
for row, line in enumerate(content.split('\n')):
    for m in re.finditer(r'[0-9]+', line):
        if int(m.group(0)) > number:
            console.write('row %d, col %d-%d: %s\n' % (row, m.start(), m.end(), m.group(0)))

, , :

This is a test 1234568
with asome pretty big numbers 0 1234567
Can anybody help?
999999999999 99999999
123

:

row 0, col 15-22: 1234568
row 3, col 0-12: 999999999999
row 3, col 13-21: 99999999

, Script, .

+2

Source: https://habr.com/ru/post/1524068/


All Articles