Retrieving data from Stream using Regex or Pattern matching

+1 vote

Hi

I am storing data into stream as below

publish contacts peter 7b61646472657373313a22736f6d652061646472657373227d

publish contacts george 7b61646472657373313a22616e6f7468657220736f6d6520616e6f74686572227d

publish contacts patricia 7b61646472657373313a2279657420616e6f7468657220616e6f74686572227d

Can I search streams to bring back all keys that starts with 'p'?

 

asked Nov 7, 2017 by srijitcnair

1 Answer

0 votes

Unfortunately this is not currently possible in MultiChain.

In the next week we're scheduled to release the first preview / alpha version of MultiChain 2.0, which will include the ability to assign multiple keys to stream items. This will give you a good workaround for this kind of pattern matching requirement, so long as you know what sort of searches you are going to do ahead of time. In your example you would assign keys to the above examples as follows:

["peter", "_prefix_p"]

["george","_prefix_g"]

["patricia","_prefix_p"]

Then you could retrieve all items with _prefix_p to do your matching based on the first character. Of course, this is still not as good as a full regular expression matching engine.

answered Nov 7, 2017 by MultiChain
...