> I want regex to match partial name to %Myvar()
>
> if i write Rakes it should match to "Rakesh Kumar"
It can most likely be done with a regex match but because the string is not consistent it gets a bit tricky (IE there is no comma in the beginning or end ) there are many regex builders on line if nobody posts it here.
The other way it can be done is with a array search. Check the user guide under 'Variables' for this ..
%arr(#?b/c)
A comma-separated list of the array indices (lowest to highest) with matching values, or 0 if none match (2,3 in the example)
Then you would search for *Rakes*
Thanks,
I got with array search by using
%array(#?%variable+)
It works fine, until there is no "." in string.
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/gbgpX5MJRK0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.
> %array(#?%variable+)
That should work fine if you are always looking for the first name.
>
> It works fine, until there is no "." in string.
Not sure what you mean by that. Where would a "." Or lack of a "." Couse this to fail?
But sometimes it throws error, I want to type only partial name and get details.. If anyone please let me know
--
It works for Rakesh Kumar but not for Deepak RP... Any idea
--
Here it goes,
Saleswar (36)
A1: Read File [ File:DropsyncFiles/sales3.csv To Var:%Mycal ]
A2: Variable Split [ Name:%Mycal Splitter:, Delete Base:Off ]
A3: Variable Query [ Title:Data Variable:%Myquery Input Type:Normal Text Default: Background Image: Layout:Variable Query Timeout (Seconds):36 Show Over Keyguard:On ]
A4: Variable Set [ Name:%Mdtt To:%Mycal(#?%Myquery+) Do Maths:Off Append:Off ]
A5: Variable Set [ Name:%Mycaln To:%Mdtt+1 Do Maths:On Append:Off ]
A6: Flash [ Text:Here is your details %Mycal(%Mdtt) Long:Off ]
A7: Set Clipboard [ Text:%Mycal(%Mycaln) Add:Off ]
A8: Variable Clear [ Name:%Mdtt Pattern Matching:Off ]
My Query is simple I will type few letter (Rak) it should match with persons full name(Rakesh Kumar) and get data
But sometimes it throws error,
What is the error?
Turn on pop up errors in preferences. Or run task with play button to see the error.
> It works for Rakesh Kumar but not for Deepak RP... Any idea
You would have to post the contents of the array and exactly what you input for a query.
>> > %array(#?%variable+)
This will not match if you enter the full name. This requires a character 'after' your query.
I would use..
%array(#?%variable*)
The results of this search are a "comma-separated list" of the array indices. So if you happen to get 2 matches you can not use the results as a integer. You need to test the results to see if there are more then one match or if it is equal to zero (no matches)
I would also convert (action/ variable/variable convert) your query to lowercase. This will match any combination of lower and upper case. If you have any uppercase characters in the query then it needs to be a exact match.
> The results of this search are a "comma-separated list" of the array indices. So if you happen to get 2 matches you can not use the results as a integer. You need to test the results to see if there are more then one match or if it is equal to zero (no matches)
In regards to this.. since there is always a result you can safely just split the resulting variable. Then test for if %var2 is set or if %var1=0
Hii Team, i got answer, actually if there are more pattern matching it was throwing error.
Than I did this,
Saleswar1 (2)
A1: Read File [ File:DropsyncFiles/sales3.csv To Var:%Mycal ]
A2: Variable Split [ Name:%Mycal Splitter:, Delete Base:Off ]
A3: Variable Query [ Title:Candidate Name Variable:%Myquery Input Type:Normal Text Default: Background Image: Layout:Variable Query Timeout (Seconds):41 Show Over Keyguard:On ]
A4: Variable Set [ Name:%Mdtt To:%Mycal(#?%Myquery+) Do Maths:Off Append:Off ]
A5: If [ %Mdtt eq 0 ]
A6: Goto [ Type:Action Number Number:15 Label: ]
A7: End If
A8: Variable Split [ Name:%Mdtt Splitter:, Delete Base:Off ]
A9: Variable Set [ Name:%Mdtta To:%Mdtt(#) Do Maths:On Append:Off ]
A10: Variable Set [ Name:%Mdttb To:%Mdtt(%Mdtta) Do Maths:Off Append:Off ]
A11: Variable Set [ Name:%Mdttc To:%Mdttb+1 Do Maths:On Append:Off ]
A12: Variable Set [ Name:%Mdttd To:%Mdttb-1 Do Maths:On Append:Off ]
A13: Flash [ Text:Here is details of %Mycal(%Mdttb) ( %Mdtta) for %Mycal(%Mdttd) Long:Off ]
A14: Set Clipboard [ Text:%Mycal(%Mdttc) Add:Off ]
A15: Array Clear [ Name:%Mycal ]
A16: Variable Clear [ Name: Pattern Matching:Off ]
A17: Flash [ Text:Data not found Long:Off ] If [ %Mdtt eq O ]
Its working fine.
--