I want to pick a word from a text file.

Get help using Construct 2

Post » Thu May 14, 2015 11:36 am

Thanks @mindfaQ !

this is what I was looking for:

RegexMatchAt(RegexMatchAt(UnknownTexT.Text,"\[([^\]\r\n]+)\]","gi",0),"\[([^\]]+)\]","i",1)

I was so close :D
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Thu May 14, 2015 2:16 pm

Message: jabedbd is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
mindfaQ wrote:Of course like always with regex the necessary complexity depends on the data you can expect / want to work with.

If the string always looks like "Hi my name is [myname].", a simple RegexMatchAt(AdvancedTextBox.Text,"Hi my name is \[(.+)\]\.","i",1) or even RegexMatchAt(AdvancedTextBox.Text,"\[(.+)\]\","i",1) will work.

If you expect multiple [] in the text and you want to match them all plus wanna filter out newlines, it could look like this:

thanks a lot bro :D Now it works for me :D
B
6
S
1
Posts: 62
Reputation: 524

Post » Thu May 14, 2015 4:27 pm

nice if you solved it was the RegexMatchAt(RegexMatchAt(UnknownTexT.Text,"\[([^\]\r\n]+)\]","gi",0),"\[([^\]]+)\]","i",1) thing forgot to mention :))
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,025

Post » Thu May 14, 2015 6:49 pm

@mindfaQ bro. now i'm facing another problem. I try to compare the value ( which i get from RegexMatchAt(RegexMatchAt(UnknownTexT.Text,"\[([^\]\r\n]+)\]","gi",0),"\[([^\]]+)\]","i",1) ) with another value.
if the the values are equal it trigger another object to Visible .

but it dont work.

Here is my event sheet system:

At first i add File Reader to read a text file (Set text Text bOx)
then i use the expression to get data from the Text Box and set the data to Text1.
I add Dictionary key "test" with value "myname"

after that i compare the Text1 data with with the dictionary key value as trigger to visible the textbox.

but do not work.

can you help me to solve it?
B
6
S
1
Posts: 62
Reputation: 524

Post » Fri Sep 16, 2016 3:17 pm

Guys I need sample capx for this one. Pleaseeee..

I type the word in textbox and it will search the result in text file
B
13
S
4
Posts: 5
Reputation: 839

Previous

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 10 guests