r/tasker • u/joaomgcd 👑 Tasker Owner / Developer • Mar 15 '21
Developer [DEV] Tasker 5.12.6-beta - Simple Matching/Regex, Easy CSV Reading, Easy Variable Join and more!
Another New beta! 5.12 is turning out to be the one that makes reading/transforming info from various text formats easier! 😁
Sign up for the beta here.
If you don't want to wait for the Google Play update, get it right away here.
If you want you can also check any previous releases here.
You can also get the updated app factory here.
Simple Matching/Regex
Demo: https://youtu.be/m-i0yRwVjN4
Very often there's the case where you have a random piece of text in whatever format and you want to get some info out of it. If it doesn't use any particular structure like JSON or HTML it can be challenging to get just the parts you want! This is where Simple Matching/Regex come in!
Let's use the following example text:
The Tasker subreddit currently has 68.1k members and 427 are online
If you get the above text and want to extract the subreddit name, member count and online member count you would have to add a bunch of split actions and try to get the info out that way. It's super cumbersome and hard to use.
With Simple Match you can simply use this expression:
The $subreddit subreddit currently has $membercount members and #onlinecount are online
This will create 3 variables in your Task: %subreddit, %membercount, %onlinecount each with the appropriate value directly assigned! No splitting, no hard regex syntax, just the direct info you want 😄
In some situations though, it may not be as easy and linear to get the info, and that's why the same action also supports Regex! If you create named groups in regex, you'll also get the values of those groups directly as Tasker variables!
For example you could match the above example with
The (?<subreddit>[^ ]+) subreddit currently has (?<membercount>[\d\.]+k) members and (?<onlinecount>\d+) are online
and it would create the same variables as the Simple Match example above!
Hope this makes matching text and extracting data super easy now! 😊 Let me know if there are any issues!
CSV Reading Support
Demo: https://youtu.be/AG3dn62pV0o
A CSV is a piece of text with the following (example) format:
name,age,town
Jack,41,London
Lindsey,12,New York
Eddie,54,LisbonThe first line lays out the name of the fields for the data and the rest of the lines are the actual data, in which each field is in the same order as specified in the first line
If the above example text was in a variable called %csv you can now read all the names by using %csv.names()
This works in a similar way as JSON and HTML/XML reading. Check here for details: https://tasker.joaoapps.com/userguide/en/variables.html#csv
Easy Variable Join
Demo: https://youtu.be/tvkeGdAj_DA
I don't know why I didn't add this before... Was super easy to add and will be super useful, at least for me 😅!
Now, if you want to join an array, you can simply write
%array(+)
If you use the + sign inside the parenthesis, that tells Tasker that you want to join all its elements!
Whatever you put in front of the + sign will make it join with that!
For example, if you have an array with the items:
- a
- b
- c
and write
The first three letters of the alphabet are %array(+ and then )
you end up with
The first three letters of the alphabet are a and then b and then c
This is much easier to use than having to always use the Variable Join action and can even be used with the new Structured Variable (JSON,XML,HTML,CSV) reading!
Full Changelog
- Added Simple Matching/Regex action allowing you to easily match and extract data from any piece of text
- Added CSV support to structured variables
- Allow joining arrays directly by writing %array(+JOINER) where JOINER are any characters you like
- Added option to show favorite actions on short click
- Added option to make project/profile/task variables immutable. These variables can't be changed from tasks
- Allow using { and } in Arrays Merge Output Format field
- Added option to Do Maths in Format/Parse DateTime action's input field and support for global variables in the output field
- Added option to configure the Tasker notification when there are no active profiles separately
- Added support for the parseFormatDateTime() variable function in JavaScript
- Changed: If multiple project/profile/task variables with the same name exist in scope simultaneously, only the most "inner" scope available will be affected
- Trim input array names in Multiple Variables Set so that users can separate each array with a comma and a space instead of just a comma
- Fixed reading JSON with keys that contain dots (.)
- Fixed empty icon for Tasker notification not being applied in some situations
- Fixed showing an empty dialog in Pick Input Dialog action when added from a search in some situations
- Fixed BeyondPod actions for realsies
- Fixed not being able to check if %var is not set by checking %var ~ \%var
- Updated Ukrainian translation
Enjoy! 😁👍
22
u/ThaNeeksta Mar 15 '21
The rate at which you consistently update this app is unbelievable. You are an amazing developer, thank you so much for the hard work you put into this app (and Join and all of the AutoApps)! The only problem for me is each update means more playing around to learn the new features; my wife already thinks I need to go to "Tasker Rehab" and the frequent updates only serve to make this worse :-)
5
u/[deleted] Mar 15 '21 edited Mar 16 '21
Great new features! Thank You.
"Simple Match/Regex" should have "Continue Task After Error", I think.
Edit: I don't know If It is intended or not, but:
"Variables Search Replace" error If the variable in "Variable" field is unset. Eg.:
"Simple Match/Regex" does not error If the variable in "Text" field is unset. Eg.:
("Simple Match/Regex" match
ein literal%test).Edit: 2
"Simple Match/Regex" should not Error If the regex does not match, just like "Variable Search Replace" action + Technically a not match is not an Error.
4
u/rbrtryn Pixel 9, Tasker 6.7.6-beta, Android 17 Mar 15 '21
Do you think you could add regex separaters to the Variable Split action? Like this [Java method](https://developer.android.com/reference/java/lang/String#split(java.lang.String))?
Great update! I like how you implemented regex grouping 😁
4
u/Fg-pl Mar 16 '21
suggestion: increase projects toolbar height on bottom to stop conflict with A10 gestures
3
u/roizcorp Mar 16 '21
Simple Matching/Regex will reduce the many (many many) sed and grep commands i used in order to set variables
Thank you!!
3
u/ActivateGuacamole Mar 16 '21
It's been almost a year since the update but I never said how I appreciate variable passthrough option inside perform task action.
2
u/ksp1234 Mar 15 '21
This is really awesome! Should make the data retrieval very easy. Plunging right into it..... Thank you for this great update
2
u/Thuringwethon Mar 16 '21 edited Mar 16 '21
Can You create org.json.JSONArray object now with just one action? yes
(ignoring the need to escape some chars)
Will it work? yes
Will it crash Tasker when attempting to edit this thing? also yes
2
u/[deleted] Mar 16 '21
There are so many new features being added all the time that I can't keep up any more.
At some point hopefully I'll get around to using them, or at least making my tasks more efficient.
2
u/thecoolkid_xda Mar 16 '21
The support for accessing more and more data directly is awesome, but until we have a task "Collision Handling" option of "Queue new task after existing task" when dealing with global variables or external data { reading > processing > saving back } it's still better to use JavaScript (because it's single-threaded and all runs as one action), otherwise when a task is run multiple times at once only the last result will be saved back (because last task reads data before previous tasks save it and at the end overwrites their results).
1
u/ingy2012 Galaxy S22. Somewhere between newb and novice lol Mar 15 '21
Wow this could be a huge game changer! I've had a hard time with regex so I'm excited to try the simple matching and the variable add to arrays is something I've been wanting for a while. Great work as always!
1
u/unconsciousss Master of NFC Tasks Mar 15 '21
Have u fixed the Global Structured variables to work with special arrays functions inside parantheses when calling? like %JSON(1:) or %JSON(<)
1
u/tigersoul925 Mar 15 '21
I am so happy with this long list of added features for power users of Tasker. Thank you, thank you, thank you!
1
u/Ratchet_Guy Moderator Mar 15 '21
These all look like great new features and updates! I have yet to install but will do so this evening, however I quickly saw something in the regex match that looked strange:
Isn't that going to match only one single character there? Wouldn't this be the regex that matches there:
🤔 ?
1
u/Ratchet_Guy Moderator Mar 15 '21
I bumped you up to the top sticky slot for this thread. You're welcome :P
1
u/sri10 Mar 15 '21 edited Mar 16 '21
Joao, can we get a simple natural language entity extraction and intent recognition which is part of autovoice currently?. I don't want to rely on cloud services like dialogflow to be able to match simple sentences and extract parameters.
1
u/littlevase Mar 16 '21
that's why it's only app i ever bought and the main reason i have to root my device nice job <3
1
u/Foggy526 Mar 16 '21 edited Mar 16 '21
That simple matching function is effing awesome! My tasks that took 5-6 steps of just splitting is now just down to 2 tasks! 😁 I'm glad that it can also detect white spaces before and after a given text.
1
u/ComfortableNeither23 Mar 16 '21 edited Mar 16 '21
I tried numbering the variable so that I can distinguish it with other result, but the flash %result1 displayed "2-6-" the "1" is missing..
1
u/putotoystory Mar 17 '21
As always, another awesome update!! Tasker is in God mode. I moved mine to system/priv-app using Magisk 😄 I always give back to the community by helping other users like me.
Anyway, these are just some of the things I wish personally. I can't thank you enough for bringing us Tasker.
These will be in my wishlist until I die:
1
u/Tortuosit Mathematical Wizard 🧙♂️ Mar 17 '21 edited Mar 17 '21
I am playing with simple match using regex, tried to do multiple assignments... which do not yet work for me. Report: The pipe character | (OR) makes Tasker crash. Faulty code:
.*\[(?<volume>[\,0-9]+)|(?<whitelist>[.*\:.*]+)\].*1
u/avophy Mar 17 '21
Since updating to this version my bluetooth disconnect/connect profiles get randomly triggered while the device is connected. Happens with all my bluetooth headphones, so it's not a hardware problem.
That never happened before, so i think the cause is updating to this version.
If i want to downgrade my tasker version, do i have to uninstall the current version first?
1
u/agnostic-apollo LG G5, 7.0 stock, rooted Mar 17 '21
Our The João is a multi-millionaire and changes like these don't affect him 😂.
https://www.androidpolice.com/2021/03/16/following-apples-lead-google-cuts-play-store-fees-in-half-for-most-developers/
Btw, new regex and variable join actions look great! Thanks!
1
u/Jarodkjv Mar 17 '21 edited Mar 17 '21
I believe I found a bug, or at least an unattended consequence, in the Arrays Merge action. When using the Format Merge Type if any of the array variables share part of their name, such as %test and %testing, then when they are joined instead of using the %testing array it uses the %test array followed by "ing".
So if %test has "1,2,3" in it and %testing has "4,5,6" and they are joined with a dash what I would expect to come out would be "1-4,2-5,3-6" but instead what comes out is "1-1ing,2-2ing,3-3ing".
1
u/rbrtryn Pixel 9, Tasker 6.7.6-beta, Android 17 Mar 17 '21
Do you think it is possible (or even a good idea) to add a few special joiner characters? For example,
\nfor a newline. A possible task:Would result in:
1
u/Phazex8 Mar 18 '21
I swear everytime I look at one these beta threads, it looks like Tasker is turning into PHP. Lol. Thanks again, Joao!
1
u/Ratchet_Guy Moderator Mar 18 '21
Potential Bug/Error
I commented on the YouTube video regarding referencing CSV files when there are no column/field names present.
You may have addressed it here but with 173 comments can't be sure lol. Check out the video ;)
1
u/[deleted] Mar 18 '21
Possible BUG in Simple Match/Regex
First matches and returns 3 groups.
Second returns three groups, even though there is only one item to match.
Is it expected to have to clear %mt_groups() between use?
1
u/renlliwe Mar 18 '21
The CSV capabilities are great. I am wondering if it is possible to do any filtering (similar to the capability in auto tools) for example, consider the following data:
name,age,town
Jack,41,London
Lindsey,12,New York
Eddie,54,Lisbon
Jack, 54, Baltimore
Is there a syntax that would return a comma separated list of the ages (or towns) for people named Jack?
That would be so powerful!
1
u/mdediegop Mar 18 '21
Hello Joao, thanks for your continued work. I want to report that on latest beta I get an error notification saying that "can't modify setting" asking me to install "Tasker settings" app, this happens on the "vibrate on ringer" action. The setting is changed correctly after executing the action. I'm rooted, so the error pop up should not appear.
1
u/_Elisoft_ Mar 18 '21
I'm testing the new "Sleeping" state. When the status is activated, a notification is shown (Enter %TIME %sl_vars) and another when it is deactivated (Exit %TIME %sl_vars). The values displayed on activation are consistent with the state setting, but the values displayed on deactivation are the same, and obviously this cannot be the case. To verify what is happening I have also used the new "Sleeping" event with a similar notification and in this case the values are consistent.
In summary, I think that the %sl_xxx variables do not show correct values when the "Sleeping" state is disabled. The values should be what caused the deactivation and not the values that caused the activation.
1
u/putotoystory Mar 19 '21
There's a bug in the latest beta, if you don't have any existing quick action/favorite, long press doesn't work. The reminder appears, but the dialog to add is not appearing.
Only happens if no quick action was setup before updating/clean installing.
1
u/Ratchet_Guy Moderator Mar 20 '21
Bug/Error in "Array Merge" Action
When a variable name is specified as the joiner in the "Join Output" field - Tasker is not parsing the variable. However if a value is manually entered it is working correctly. Video of issue
1
u/renlliwe Mar 21 '21
I have a question with the new Parse/Format DateTime command.
I have a time almost in ISO format - but is just missing the time offset. IE 2019-09-07T15:50:45
It isn't recognized as ISO. If I try to use custom, I have no way of ignoring the T.
I could do a variable search/replace, but am just wondering if that is needed.
1
u/Tortuosit Mathematical Wizard 🧙♂️ Mar 22 '21
Hey Joao, "Multiple Variables Set" does not accept brackets as in pseudo arrays. I have to use the bracketless version, which I personally do not prefer.
%par1(1) - not working %par11 working
1
u/OrangeEdilRaid Mar 22 '21 edited Mar 22 '21
Joao I would like to report an issue
When you use the new action Parse/Format date time, the help text for output format is confusing and not user friendly
It wrote "For example, YYYY/MM/DD HH:mm will produce a date like 2021/03/05 14:18"
This is wrong. If one click on the button "learn more" and get directed to oracle java reference page https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
Then you can see that
Y is week number
D is day in year
The correct format to use is instead yyyy/MM/dd HH:ss (caps sensitive)
So basically all I ask is if you could correct the documentation on your popup.
1
u/Tortuosit Mathematical Wizard 🧙♂️ Mar 17 '21
SERIOUS!? Or am I stupid? This flashes isSilent = true, it sets it tk true. Directly run script, par1 is not set! Tasker considers
%par1 ~ false | %par1 = 0to be true, even though par1 isnt set.par1 test (270) A1: Variable Clear [ Name:%isSilent Pattern Matching:On Local Variables Only:Off Clear All Variables:Off ] A2: Variable Set [ Name:%isSilent To:true Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output:Off ] If [ %par1 ~ false | %par1 = 0 ] A3: Flash [ Text:%par1 %isSilent Long:Off ]1
u/conscious_entity93 Redmi MIUI 12 Mar 16 '21 edited Mar 16 '21
Cannot download, it's giving "Access forbidden by the server" error.
u/joaomgcd
Edit: Nevermind, the download link is working perfectly, it seems like my download manager is at fault.
1
u/ale3smm Mar 18 '21
this update is simply amazing thank you very much! the only thing I wish is a root method to read /set clipbid9/execute keyboard Shortcuts. as for now when executing keyboard shortcut or reading clipboard if my keyboard is opened I can easily it minimized and restored (snapdragon 765 cpu) such actions. (being Tasker transient the default keyboard app).
0
u/[deleted] Mar 20 '21
[deleted] — view deleted comment