GraphLinq IDE v1.3.4 Is Live! New Blocks & Updates
The last two weeks have seen updates, fixes, and new features added to the GraphLinq IDE. This week we are releasing another update to the platform which includes six new blocks for a total of 286 blocks available in the GraphLinq IDE
In this latest release, we’ve added another output to the
On User Tweet event block. This block is an event that is triggered whenever the user you are monitoring sends a new tweet to their followers. Prior to this release, the block only allowed you to grab the text of the tweet. We’ve added a new output called
link which returns the direct link to the tweet.
If you missed last week's article, or are unfamiliar with how Timestamp Offsets work, you can read more about the GraphLinq IDE 1.3.3 Updates that were released last week. We’ve added the option for offsetting by weeks using the
w character. You can now offset a timestamp by Hours, Days, Weeks, or Years.
The six new blocks that were added are for working with strings (or text). Let’s just dive in with some examples!
Most of the time when working with data, it’s either in an array, JSON, or a comma-separated list. But what if you want to work with data that was separated by a character other than the comma? Now you can! In the example below, the string “Example|using|pipes|to|split” is separated using the pipe character. (It’s the one that’s above the enter button… yes, that’s called a pipe!)
String Contains Multiple
Similar to the existing block called
String Contains which checks if a string of text contains another string,
String Contains Multiple allows you to provide a comma-separated list of values, and if a match on any of them is found in the original string, the block returns true. Here are two examples:
Regular Expressions (RegEx)
Before we move on to the final four new blocks that have been added we need to talk about regular expressions. For those who know, RegEx can be a powerful coding tool (when used correctly). If you don’t know what RegEx is we can let a xkcd cartoon explain.
In case that didn’t help, here is how Wikipedia defines RegEx:
A regular expressions is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for “find” or “find and replace” operations on strings, or for input validation.
String Replace Using RegEx
In the example below we will use RegEx to search the string and replace all matches. The original string we start with is:
This is the best. Many can do it all.
For our Regular Expression we are going to use ([A-Z])\w+ which means to search for any capital letter and match the rest of the word when it is found.
Finally, we are going to use the string GraphLinq for what we want to replace our matches with. Here is the result.
The RegEx we provided matched the words This and Many in our original string and replaced them with the word GraphLinq.
String Get Match Using RegEx
This block returns the first match that is found in the original string. Again we are looking for the same expression, that starts with a capital letter, and returns the rest of the word.
String Matches RegEx (Conditional)
Conditional blocks are ones that follow a true/false logic flow to continue their execution. Just as in previous examples, we are going to search for any capital letters.
String Get All Match Using RegEx
By now you might be thinking, what if I want to return all the matches my RegEx found? We’ve got that covered too.
There are plenty of tools online to learn more about RegEx and there are even websites that will help you build and test your RegEx right in the browser! Check out regexr.com to learn more.