Find/replace text help

hello

i have a question...i hope someone can help me....

i use the action "text/find replace" to find a special 32 long digit in a textfile....

unter the option "search String" i use this code

\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w\w

this works fine....after finding this 32 digits i want put it in a variable or in a other textfile....but to bad i just have options to replace the text i have found....

is there any other option to find a special text and put it in a varibale or textfile ?

Thx Frank

Hi Frank,

Thanks for your post.

As an aside, you should be able to use the syntax \w{32} to find a 32-digit long number. No more need for counting individual \ws. :-).

To answer your question, there is an OnFindText script event on the action with a parameter called FoundText. You can do something like

MyBigNumberVariable = FoundText


… to save it to a FB variable called “MyBigNumberVariable”.

Hth.

Regards,

Angus

It’s a limitation in the current version of text find/replace. My normal workaround:
1. Read the text file into a variable
2. Find/replace with a string like: ([0-9]{32}) <- note the parentheses
3. Choose “replace” and “save to same variable” (or whatever it’s called)
4. Set $1 as the replacement string.

Obviously you have to select regex, and enable the $1 type replacement strings.

Then basically you’ll be replacing the entire contents of the file (in memory) with just the contents of that 1 string.

Steve

Crossed posts!

Yes, Steve's workaround works as well. I think the forum software mangled the regex, though...

(\w{32}) will work for this, as well. Replace \w with \d if you only need numbers, not numbers and characters.

There's a great regular expression reference here: http://www.regular-expressions.info/reference.html

Regards,

Angus

thank you very much guys...that looks both very good...it works like a charm :D :D BOTH !!!!