1

Topic: Search in the text

Question how to organize search in the text.
Let's assume the text in the document it is divided for the lines
I can search  in line. But what if  affects some lines???
There should be ready algorithms!

2

Re: Search in the text

Regular  it . But I should find in what lines coincidence is found. If coincidence a little that  all.
That is as I understood to measure length of the required text (we tell 20 characters) we take the first 20 characters of the text of the document and we compare. If there is no that we shift on the character and we compare again. I  a direction think or not?

3

Re: Search in the text

Areostar wrote:

But what if  affects some lines???

If in substring there is a character () line feed - that coincidence is obliged "to affect some lines". And if those are not present - that coincidence CAN not "affect some lines".

4

Re: Search in the text

5

Re: Search in the text

Areostar wrote:

the Question how to organize search in the text.
There should be ready algorithms!

Yes it is full. You on what  gathered, the kid?
https://www.regexbuddy.com/programming.html

6

Re: Search in the text

Areostar wrote:

we take the first 20 characters of the text of the document and it is compared. If there is no that it is shifted on the character and it is compared again. I  a direction think or not?

Not effectively. Better, we take the text and we search in it for the first character from a required line. If it is found, then already from the following position we compare a line. If lines coincided, we pass to search since the following character after a line end. If did not coincide - that to search, since the following character after found in the first search.

7

Re: Search in the text

ptr128;
In it there is a sense! smile I will think further

8

Re: Search in the text

The size of the text?

9

Re: Search in the text

Akina;
Well on the average some honeycombs of lines

10

Re: Search in the text

Areostar then it is stupid to load all in storage to clean transfers of lines from the text and from a template, and to use regular function of search of substring in line.

11

Re: Search in the text

Akina wrote:

to use regular function of search of substring in line

Areostar wrote:

If coincidence a little that  all

In a cycle

12

Re: Search in the text

Areostar wrote:

regular  it . But I should find in what lines coincidence is found. If coincidence a little that  all.
That is as I understood to measure length of the required text (we tell 20 characters) we take the first 20 characters of the text of the document and we compare. If there is no that we shift on the character and we compare again. I  a direction think or not?

In the given spherical setting - to you quite approach . For them - transfers of lines
It simply any character class of separators like gaps and .
That there concerning length - it is not clear. If you took API  in Java/.Net that result
Search there will be a dial-up of objects-groups (Groups) or a collection of groups. And you walk on them in a cycle
Also you do any checks further.
If the task too for you is difficult - that break it into stages. For example in the first
Of rowset of the lines divided by transfers - you do one big line
Etc.

13

Re: Search in the text

Ruslan Damirovich;
Already mentioned possibility of that that a part of required substring can be in single line, a little in another

14

Re: Search in the text

mayton;
I think to implement on python. As it should be  this language.
For the interface recommend Qt+python