TIBCOSoftware / flogo

Project Flogo is an open source ecosystem of opinionated event-driven capabilities to simplify building efficient & modern serverless functions, microservices & edge apps.
http://flogo.io
BSD 3-Clause "New" or "Revised" License
2.42k stars 288 forks source link

Enhancement request for a regex mapper function to pick out fields from strings #305

Open opendevpmm opened 6 years ago

opendevpmm commented 6 years ago

I'm submitting a ... (check one with "x")

[] bug report => search github for a similar issue or PR before submitting
[X] feature request
[] support request
[] general question

Current behavior (how does the issue manifest): Limited set of functions available to manipulate the messages passed between activities in a flow.

Expected behavior: Providing a regex function would be a powerful way to manipulate the information passed between activities in any manner desired.

Minimal steps to reproduce the problem (not required if feature enhancement): Requested function does not exist, no need to reproduce.

What is the motivation / use case for changing the behavior? Powerful way to make the tool more useful.

Please tell us about your environment (Operating system, docker version, browser & web ui version, etc): MacOS X version 10.13.5 Docker version 18.03.1-ce, build 9ee9f40 Browser: Firefox Quantum 61.0

Flogo version (CLI & contrib/lib. If unknown, leave empty or state unknown): 0.X.X Flogo version 0.5.3

Additional information you deem important (e.g. issue happens only occasionally):

ayh20 commented 6 years ago

Hi ... what regex function are you looking for ? Looking at https://gobyexample.com/regular-expressions which functions did you have in mind ? I was thinking about adding a MatchString function but i guess that's not what you were thinking of .....

opendevpmm commented 6 years ago

Hi Andy,

Apologies for the delay, I missed this email somehow.

Ideally all the regular expressions matches would be supported, for instance, if I could do something like:

(a, b, c) = regex ($input_string, /^\d*(\w+)[a-f0-9]+(\w+)\s+(\S+)\w+$/)

The idea is to be able to get any kind of output format from an input string. For example, in a MQTT message, I could have a topic that says:

“Sensors/door/12”

And a message that says

“Status=open”,

I would then be able to subscribe for “Sensors/#” and create a message that says “Door 12 is open” by using the regex on both topic and message. (/^\w+\/(\w+)\/(\d+$)/) and (/^Status=(\w+)$/)

Thanks, Shekhar -- Shékhar Patkar | Product Marketing, Open Source | O +1 650 846 5306 <> | M +1 (408) 761-5433 <> | E shpatkar@tibco.com mailto:shpatkar@tibco.com

On Jul 3, 2018, at 4:32 AM, Andy Hampshire notifications@github.com wrote:

Hi ... what regex function are you looking for ? Looking at https://gobyexample.com/regular-expressions https://gobyexample.com/regular-expressions which functions did you have in mind ? I was thinking about adding a MatchString function but i guess that's not what you were thinking of .....

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TIBCOSoftware/flogo/issues/305#issuecomment-402121880, or mute the thread https://github.com/notifications/unsubscribe-auth/Ak_yNqsA0o3HdEyLaJlaR_6trfZX-Zl3ks5uC1ZngaJpZM4VAKF6.