How to remove Numbers from Variable Value

273 views
Skip to first unread message

Saad Thahim

unread,
Apr 10, 2015, 1:43:36 AM4/10/15
to tas...@googlegroups.com
How can i remove numbers and special characters from a value.

Iam using auto input to fetch names from Instagram.
Some names have numbers and some dont and some have underscores and periods and some dont.

When storing results i want to remove numbers and other things from those names and if they dont have leave them.
How can i do this in tasker?

Robert Ryan

unread,
Apr 10, 2015, 2:09:33 AM4/10/15
to tas...@googlegroups.com
You can use the Variable Search Replace action to sesrch for the characters that you want to remove. Check the replace matches box, but leave the replacement text blank. This will remove the matched characters.

Saad Thahim

unread,
Apr 10, 2015, 2:12:02 AM4/10/15
to tas...@googlegroups.com
But i can not have multiple searches in just one action? Do I?

people have random numbers like 123, 92, 456.
I want something which can detect all numbers from 1 to 9 in which ever format they are and then remove them.

Saad Thahim

unread,
Apr 10, 2015, 2:14:03 AM4/10/15
to tas...@googlegroups.com
I have dont this

Filter Test (45)
A1: Variable Set [ Name:%name To:fatima_mangi123 Do Maths:Off Append:Off ] 
A2: Variable Search Replace [ Variable:%name Search:1,2,3 Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In:%namef Replace Matches:On Replace With: ] 
A3: Flash [ Text:%namef Long:Off ] 


still %namef is empty

On Friday, 10 April 2015 11:09:33 UTC+5, Robert Ryan wrote:

Robert Ryan

unread,
Apr 10, 2015, 2:33:11 AM4/10/15
to tas...@googlegroups.com
You search string needs to be a regular expression. For a tutorial on regular expressions, see http://goo.gl/OlatyA

For this particular situation, try \d+

Saad Thahim

unread,
Apr 10, 2015, 2:34:19 AM4/10/15
to tas...@googlegroups.com
thanks robert, let me check this tutorial and get back to you.

Saad Thahim

unread,
Apr 10, 2015, 2:39:35 AM4/10/15
to tas...@googlegroups.com
thanks it worked but it doesn't replaces a period (.)
when there is a . in a variable it just deleted the variable. 


On Friday, 10 April 2015 11:33:11 UTC+5, Robert Ryan wrote:

Robert Ryan

unread,
Apr 10, 2015, 10:15:36 AM4/10/15
to tas...@googlegroups.com
The dot is special, it matches any character. So the expression .+ would indeed match every character in the string.

Either escape the dot with a \, or put it in a character class: [0-9.]

Saad Thahim

unread,
Apr 10, 2015, 12:05:56 PM4/10/15
to tas...@googlegroups.com
I have used [0-9] in one item and created another with [-.] And its working.
Reply all
Reply to author
Forward
0 new messages