Ricerca all'interno di un grande testo

Hello everyone,
it would be possible to perform a free search on a 9 Mb text file; maybe using some extension that looks like a TextBox, with a search function inside?

What do you want to return from the search ?

My initial thoughts are to use a regex extension....

You probably want to see the surrounding text, to know how many hits you got, and to navigate from one hit to the next.

If you can read the entire file into a global variable, split the global variable at all the occurences of your search term.

Take your resulting list, and interlace it with list items containing that search term.

Show the resulting list with a List Picker.

What's the data structure? this data is read-only? or need to modify later?

This data is read-only

What is a regex extension?

Please answer my question first. What do you want to return from a search of your text file? Also, is it just text or in CSV format?

This is essentially a 9MB text-only file. So I want to carry out a simple search, which can return a sentence or text; as it is possible to do within any web page, using the "Find" button.

the text file has to be in some pattern/format/structure.
pls show us at least part of the data.

Search function will return a list, the list item will contains: 10 letters before the segment +segment+ 10 letters after the segment.



blocks are draggable.

this search function did not consider one situation: when there is no match. I left it to you to implement it.

Searching by code works, but would be more comprehensive; be able to do it directly through the ShowFilterBar of the ListView

In that case, all you need to do is split the original text at '.' (end of sentence), load the resulting list into the ListView, and expose the ListView search option.

Using a multiline textbox or label how can I highlight all occurrences?

Take the input text and wrap the search results with markups for bold. Show the new text in a HTML label.

Perhaps see List Blocks On App Inventor | imagnity

See please my block, it runs but loses all new lines

The html equivalent of \n is <br>.
You can do 2 replacements, or use the fancy replace with dictionary block.

I tried but no newline

Use the Companion's Do It at these test points to see where the newlines are lost:

  • Textbox1.Text
  • the replace all text block on Textbox1.Text
  • lbText.Text
  • the replace all text block on lbText.Text

P.S. Also try using a global variable for the intermediate replace result, or feed the replacements directly into each other.

1 Like

It runs now, thanks.